diff --git a/src/core/empty-fresh.json b/src/core/empty-fresh.json index 347def5..a4cb460 100644 --- a/src/core/empty-fresh.json +++ b/src/core/empty-fresh.json @@ -47,6 +47,7 @@ "position": "", "summary": "", "start": "", + "end": "", "keywords": [], "highlights": [] } diff --git a/src/core/fresh-resume.js b/src/core/fresh-resume.js index 4e76822..fb74a58 100644 --- a/src/core/fresh-resume.js +++ b/src/core/fresh-resume.js @@ -213,6 +213,15 @@ Definition of the FRESHResume class. delete this.social; }; + /** + Get a safe count of the number of things in a section. + */ + FreshResume.prototype.count = function( obj ) { + if( !obj ) return 0; + if( obj.history ) return obj.history.length; + return obj.length || 0; + } + /** Get the default (empty) sheet. */ @@ -226,9 +235,14 @@ Definition of the FRESHResume class. */ FreshResume.prototype.add = function( moniker ) { var defSheet = FreshResume.default(); - var newObject = $.extend( true, {}, defSheet[ moniker ][0] ); + var newObject = defSheet[moniker].history ? + $.extend( true, {}, defSheet[ moniker ].history[0] ) : + $.extend( true, {}, defSheet[ moniker ][0] ); this[ moniker ] = this[ moniker ] || []; - this[ moniker ].push( newObject ); + if( this[ moniker ].history ) + this[ moniker ].history.push( newObject ); + else + this[ moniker ].push( newObject ); return newObject; };