From 16cf97e08ea04d5978038a4276659097c2ad2cc2 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Fri, 20 Nov 2015 08:27:39 -0500 Subject: [PATCH] Improve converter. --- src/core/convert.js | 112 ++++++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 34 deletions(-) diff --git a/src/core/convert.js b/src/core/convert.js index 8745ee3..7e15cbf 100644 --- a/src/core/convert.js +++ b/src/core/convert.js @@ -23,7 +23,7 @@ FRESH to JSON Resume conversion routiens. info: { label: jrs.basics.label, - class: jrs.basics.label, + //class: jrs.basics.label, image: jrs.basics.picture, brief: jrs.basics.summary }, @@ -32,8 +32,23 @@ FRESH to JSON Resume conversion routiens. email: jrs.basics.email, phone: jrs.basics.phone, website: jrs.basics.website + //other: [none] }, + meta: jrs.meta, + + // disposition: { + // travel: 25, + // relocation: true, + // authorization: "citizen", + // commitment: ["full-time","permanent","contract"], + // remote: true, + // relocation: { + // willing: true, + // destinations: [ "Austin, TX", "California", "New York" ] + // } + // }, + location: { city: jrs.basics.location.city, region: jrs.basics.location.region, @@ -68,8 +83,8 @@ FRESH to JSON Resume conversion routiens. curriculum: edu.courses, url: edu.website || edu.url || null, summary: null, - // ???: edu.area, TODO - // ???: edu.studyType TODO + area: edu.area, + studyType: edu.studyType }; }) }, @@ -89,25 +104,18 @@ FRESH to JSON Resume conversion routiens. }) }, - skills: jrs.skills.map(function(sk){ - return { - name: sk.name, - summary: "", - level: sk.level, - summary: sk.keywords.join(', '), - years: null, - proof: null - }; - }), + skills: skillsToFRESH( jrs.skills ), - publications: jrs.publications.map(function(pub){ + writing: jrs.publications.map(function(pub){ return { title: pub.name, publisher: pub.publisher, link: [ { 'url': pub.website } ], - year: pub.releaseDate + year: pub.releaseDate, + date: pub.releaseDate, + summary: pub.summary }; }), @@ -132,7 +140,9 @@ FRESH to JSON Resume conversion routiens. interests: jrs.interests, - references: jrs.references + references: jrs.references, + + languages: jrs.languages }; }, @@ -145,13 +155,14 @@ FRESH to JSON Resume conversion routiens. basics: { name: fresh.name, + label: fresh.info.label, summary: fresh.info.brief, - website: fresh.info.website, - phone: fresh.info.phone, - email: fresh.info.email, + website: fresh.contact.website, + phone: fresh.contact.phone, + email: fresh.contact.email, picture: fresh.info.image, location: { - address: fresh.location.address.join('\n'), + address: fresh.location.address, postalCode: fresh.location.code, city: fresh.location.city, countryCode: fresh.location.country, @@ -169,6 +180,7 @@ FRESH to JSON Resume conversion routiens. work: fresh.employment.history.map(function(emp){ return { company: emp.employer, + website: emp.url, position: emp.position, startDate: emp.start, endDate: emp.end, @@ -184,20 +196,12 @@ FRESH to JSON Resume conversion routiens. courses: edu.curriculum, startDate: edu.start, endDate: edu.end, - area: "", // TODO - studyType: "" + area: edu.area, + studyType: edu.studyType }; }), - skills: fresh.skills.map( function(sk){ - return { - name: sk.name, - level: sk.level, - keywords: [], // TODO - //???: sk.years, - //???: sk.summary - }; - }), + skills: skillsToJRS( fresh.skills ), volunteer: fresh.service.history.map(function(srv){ return { @@ -223,10 +227,10 @@ FRESH to JSON Resume conversion routiens. }; }), - publications: fresh.publications.map(function(pub){ + publications: fresh.writing.map(function(pub){ return { name: pub.title, - publisher: "", // TODO + publisher: pub.publisher, releaseDate: pub.date, website: pub.link[0].url, summary: pub.summary @@ -235,7 +239,9 @@ FRESH to JSON Resume conversion routiens. interests: fresh.interests, - references: fresh.references + references: fresh.references, + + languages: fresh.languages }; @@ -243,4 +249,42 @@ FRESH to JSON Resume conversion routiens. }; + function skillsToFRESH( skills ) { + + return { + sets: skills.map(function(set) { + return { + name: set.name, + level: set.level, + skills: set.keywords + }; + }) + }; + } + + function skillsToJRS( skills ) { + var ret = []; + if( skills.sets && skills.sets.length ) { + ret = skills.sets.map(function(set){ + return { + name: set.name, + level: set.level, + keywords: set.skills + }; + }); + } + else if( skills.list ) { + ret = skills.list.map(function(sk){ + return { + name: sk.name, + level: sk.level, + keywords: sk.keywords + }; + }); + } + return ret; + } + + + }());