1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-07-03 17:01:05 +01:00

Interim changes supporting v1.3.0.

This commit is contained in:
hacksalot
2015-12-31 03:34:41 -05:00
parent 1f6d77fc28
commit 069c02ddcc
10 changed files with 234 additions and 82 deletions

View File

@ -1,6 +1,6 @@
/**
Definition of the JRSResume class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@license MIT. See LICENSE.md for details.
@module jrs-resume.js
*/
@ -12,6 +12,7 @@ Definition of the JRSResume class.
, _ = require('underscore')
, PATH = require('path')
, MD = require('marked')
, CONVERTER = require('./convert')
, moment = require('moment');
/**
@ -51,6 +52,24 @@ Definition of the JRSResume class.
return this;
};
/**
Save the sheet to disk in a specific format, either FRESH or JRS.
*/
JRSResume.prototype.saveAs = function( filename, format ) {
if( format === 'JRS' ) {
this.basics.imp.fileName = filename || this.imp.fileName;
FS.writeFileSync( this.basics.imp.fileName, this.stringify(), 'utf8' );
}
else {
var newRep = CONVERTER.toFRESH( this );
var stringRep = CONVERTER.toSTRING( newRep );
FS.writeFileSync( filename, stringRep, 'utf8' );
}
return this;
};
/**
Convert this object to a JSON string, sanitizing meta-properties along the
way. Don't override .toString().
@ -92,6 +111,7 @@ Definition of the JRSResume class.
if( opts.imp === undefined || opts.imp ) {
this.basics.imp = this.basics.imp || { };
this.basics.imp.title = (opts.title || this.basics.imp.title) || this.basics.name;
this.basics.imp.orgFormat = 'JRS';
}
// Parse dates, sort dates, and calculate computed values
(opts.date === undefined || opts.date) && _parseDates.call( this );