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

feat: support JSON Resume edge schema

This commit is contained in:
hacksalot
2018-02-10 01:10:20 -05:00
parent 7cfdb95a04
commit 7196bff27c
4 changed files with 31 additions and 35 deletions

View File

@ -94,11 +94,10 @@ class FreshResume# extends AbstractResume
###*
Save the sheet to disk in a specific format, either FRESH or JSON Resume.
###
saveAs: ( filename, format, version ) ->
saveAs: ( filename, format ) ->
# If format isn't specified, default to FRESH
safeFormat = (format || 'FRESH').trim()
safeVersion = version || "0"
safeFormat = (format && format.trim()) || 'FRESH'
# Validate against the FRESH version regex
# freshVersionReg = require '../utils/fresh-version-regex'
@ -106,11 +105,14 @@ class FreshResume# extends AbstractResume
# throw badVer: safeFormat
parts = safeFormat.split '@'
if parts[0] == 'FRESH'
@imp.file = filename || @imp.file
FS.writeFileSync @imp.file, @stringify(), 'utf8'
else if parts[0] == 'JRS'
newRep = CONVERTER.toJRS @, null, if parts.length > 1 then parts[1] else "1"
useEdgeSchema = if parts.length > 1 then parts[1] == '1' else false
newRep = CONVERTER.toJRS @, edge: useEdgeSchema
FS.writeFileSync filename, JRSResume.stringify( newRep ), 'utf8'
else
throw badVer: safeFormat