From 8273e7d15086a0267423db022b47b156066654b0 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Tue, 15 Dec 2015 06:20:06 -0500 Subject: [PATCH] ... --- src/core/empty-fresh.json | 1 + src/core/fresh-resume.js | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) 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; };