mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-03 12:57:08 +01:00
feat: convert: support multiple JRS versions
This commit is contained in:
23
dist/core/fresh-resume.js
vendored
23
dist/core/fresh-resume.js
vendored
@ -109,14 +109,27 @@ Definition of the FRESHResume class.
|
||||
Save the sheet to disk in a specific format, either FRESH or JSON Resume.
|
||||
*/
|
||||
|
||||
FreshResume.prototype.saveAs = function(filename, format) {
|
||||
var newRep;
|
||||
if (format !== 'JRS') {
|
||||
FreshResume.prototype.saveAs = function(filename, format, version) {
|
||||
var freshVersionReg, newRep, parts, safeFormat, safeVersion;
|
||||
safeFormat = (format || 'FRESH').trim();
|
||||
safeVersion = version || "0";
|
||||
freshVersionReg = require('../utils/fresh-version-regex');
|
||||
if (!freshVersionReg().test(safeFormat)) {
|
||||
throw {
|
||||
badVer: safeFormat
|
||||
};
|
||||
}
|
||||
parts = safeFormat.split('@');
|
||||
if (parts[0] === 'FRESH') {
|
||||
this.imp.file = filename || this.imp.file;
|
||||
FS.writeFileSync(this.imp.file, this.stringify(), 'utf8');
|
||||
} else {
|
||||
newRep = CONVERTER.toJRS(this);
|
||||
} else if (parts[0] === 'JRS') {
|
||||
newRep = CONVERTER.toJRS(this, null, parts.length > 1 ? parts[1] : "1.0.0");
|
||||
FS.writeFileSync(filename, JRSResume.stringify(newRep), 'utf8');
|
||||
} else {
|
||||
throw {
|
||||
badVer: safeFormat
|
||||
};
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
3
dist/core/status-codes.js
vendored
3
dist/core/status-codes.js
vendored
@ -37,7 +37,8 @@ Status codes for HackMyResume.
|
||||
invalidOptionsFile: 27,
|
||||
optionsFileNotFound: 28,
|
||||
unknownSchema: 29,
|
||||
themeHelperLoad: 30
|
||||
themeHelperLoad: 30,
|
||||
invalidSchemaVersion: 31
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
Reference in New Issue
Block a user