1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-06-07 21:16:14 +01:00

Generate ANALYZE console output from Handlebars template.

This commit is contained in:
hacksalot
2016-01-09 20:18:56 -05:00
parent 540ad48d61
commit f18910f490
3 changed files with 98 additions and 43 deletions

View File

@ -30,25 +30,29 @@ Section analysis for HackMyResume.
/**
Run the Totals Inspector on a resume.
@method run
@return An array of objects containing summary information for each section
on the resume.
@return An object containing summary information for each section on the
resume.
*/
run: function( rez ) {
var ret = { };
var sectionTotals = { };
_.each( rez, function(val, key){
if( _.isArray( val ) && !_.isString(val) ) {
ret[ key ] = val.length;
sectionTotals[ key ] = val.length;
}
else if( val.history && _.isArray( val.history ) ) {
ret[ key ] = val.history.length;
sectionTotals[ key ] = val.history.length;
}
else if( val.sets && _.isArray( val.sets ) ) {
ret[ key ] = val.sets.length;
sectionTotals[ key ] = val.sets.length;
}
});
return ret;
return {
totals: sectionTotals,
numSections: Object.keys( sectionTotals ).length
};
}