1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 08:20:11 +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": "",
"summary": "",
"start": "",
"end": "",
"keywords": [],
"highlights": []
}

View File

@ -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;
};