1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-05 09:56:22 +00:00
This commit is contained in:
devlinjd 2015-12-15 06:20:06 -05:00
parent 5c49a8297f
commit 8273e7d150
2 changed files with 17 additions and 2 deletions

View File

@ -47,6 +47,7 @@
"position": "", "position": "",
"summary": "", "summary": "",
"start": "", "start": "",
"end": "",
"keywords": [], "keywords": [],
"highlights": [] "highlights": []
} }

View File

@ -213,6 +213,15 @@ Definition of the FRESHResume class.
delete this.social; 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. Get the default (empty) sheet.
*/ */
@ -226,8 +235,13 @@ Definition of the FRESHResume class.
*/ */
FreshResume.prototype.add = function( moniker ) { FreshResume.prototype.add = function( moniker ) {
var defSheet = FreshResume.default(); 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 ] = this[ moniker ] || [];
if( this[ moniker ].history )
this[ moniker ].history.push( newObject );
else
this[ moniker ].push( newObject ); this[ moniker ].push( newObject );
return newObject; return newObject;
}; };