//Serializes the configuration into a string function serializeEnabledSections(sections, enabledSections) { var configurableSections = _.filter(sections, function(s) { return s.configurable; }); var enabledSectionList = _.filter(_.keys(enabledSections), function(s) { return enabledSections[s];}); var head, listedIds = []; if (enabledSectionList.length == configurableSections.length) { head = CONFIG_COMMENT + CONFIG_ALL; listedIds = []; } else if (enabledSectionList.length/3 > configurableSections.length/2) { head = CONFIG_COMMENT + CONFIG_ALL_EXCEPT; listedIds = _.filter(configurableSections, function(s) { return !enabledSections[s.id]; }).collect(function(s) { return s.id; }); } else { head = CONFIG_COMMENT + CONFIG_ONLY; listedIds = enabledSectionList; } var txt = "// " + CONFIG_START + " use this comment to re-create configuration in the Builder\n" + head; var charsToBreak = 50; _(listedIds).sort().each(function(id) { if (charsToBreak < id.length) { charsToBreak = 70; txt += '\n// - ' + id + ', '; } else { txt += id + ', '; charsToBreak -= id.length + 2; } }); txt = txt.replace(/,\s*$/, '.\n'); // remove last comma with period return txt; }
function serializeEnabledSections(n,f){var j=_.filter(n,function(e){return e.configurable}),h=_.filter(_.keys(f),function(e){return f[e]}),l,r=[];h.length==j.length?(l=CONFIG_COMMENT+CONFIG_ALL,r=[]):h.length/3>j.length/2?(l=CONFIG_COMMENT+CONFIG_ALL_EXCEPT,r=_.filter(j,function(e){return!f[e.id]}).collect(function(e){return e.id})):(l=CONFIG_COMMENT+CONFIG_ONLY,r=h);var q="// "+CONFIG_START+" use this comment to re-create configuration in the Builder\n"+l,e=50;_(r).sort().each(function(f){e<f.length? (e=70,q+="\n// - "+f+", "):(q+=f+", ",e-=f.length+2)});return q=q.replace(/,\s*$/,".\n")}function fixConfig(n,f){_.eachObj(f,function(j){n[j]?_.copyObj(n[j].requires,f):delete f[j]});return f}
function serializeEnabledSections(k,g){var l=_.filter(k,function(d){return d.configurable}),f=_.filter(_.keys(g),function(d){return g[d]}),j,u=[];f.length==l.length?(j=CONFIG_COMMENT+CONFIG_ALL,u=[]):f.length/3>l.length/2?(j=CONFIG_COMMENT+CONFIG_ALL_EXCEPT,u=_.filter(l,function(d){return!g[d.id]}).collect(function(d){return d.id})):(j=CONFIG_COMMENT+CONFIG_ONLY,u=f);var v="// "+CONFIG_START+" use this comment to re-create configuration in the Builder\n"+j,d=50;_(u).sort().each(function(f){d<f.length? (d=70,v+="\n// - "+f+", "):(v+=f+", ",d-=f.length+2)});return v=v.replace(/,\s*$/,".\n")}function fixConfig(k,g){_.eachObj(g,function(l){k[l]?_.copyObj(k[l].requires,g):delete g[l]});return g}