1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-09-28 20:19:12 +01:00
HackMyResume/src/inspectors/totals-inspector.coffee
hacksalot 0f65e4c9f3 Finish HackMyCore reshaping.
Reintroduce HackMyCore, dropping the interim submodule, and reorganize
and improve tests.
2016-01-29 15:23:57 -05:00

37 lines
939 B
CoffeeScript

###*
Section analysis for HackMyResume.
@license MIT. See LICENSE.md for details.
@module inspectors/totals-inspector
###
_ = require 'underscore'
FluentDate = require '../core/fluent-date'
###*
Retrieve sectional overview and summary information.
@class totalsInspector
###
totalsInspector = module.exports =
moniker: 'totals-inspector'
###*
Run the Totals Inspector on a resume.
@method run
@return An object containing summary information for each section on the
resume.
###
run: ( rez ) ->
sectionTotals = { }
_.each rez, (val, key) ->
if _.isArray( val ) && !_.isString(val)
sectionTotals[ key ] = val.length
else if val.history && _.isArray( val.history )
sectionTotals[ key ] = val.history.length;
else if val.sets && _.isArray( val.sets )
sectionTotals[ key ] = val.sets.length;
totals: sectionTotals,
numSections: Object.keys( sectionTotals ).length