mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Tweak converter.
This commit is contained in:
parent
4de997840e
commit
5304cbabd9
@ -15,55 +15,45 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
/**
|
/**
|
||||||
Convert from JSON Resume format to FRESH.
|
Convert from JSON Resume format to FRESH.
|
||||||
*/
|
*/
|
||||||
toFRESH: function( jrs ) {
|
toFRESH: function( src, foreign ) {
|
||||||
|
|
||||||
|
foreign = (foreign === undefined || foreign === null) ? true : foreign;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
name: jrs.basics.name,
|
name: src.basics.name,
|
||||||
|
|
||||||
info: {
|
info: {
|
||||||
label: jrs.basics.label,
|
label: src.basics.label,
|
||||||
//class: jrs.basics.label,
|
class: src.basics.class, // <--> round-trip
|
||||||
image: jrs.basics.picture,
|
image: src.basics.picture,
|
||||||
brief: jrs.basics.summary
|
brief: src.basics.summary
|
||||||
},
|
},
|
||||||
|
|
||||||
contact: {
|
contact: {
|
||||||
email: jrs.basics.email,
|
email: src.basics.email,
|
||||||
phone: jrs.basics.phone,
|
phone: src.basics.phone,
|
||||||
website: jrs.basics.website
|
website: src.basics.website,
|
||||||
//other: [none]
|
other: src.basics.other // <--> round-trip
|
||||||
},
|
},
|
||||||
|
|
||||||
meta: meta2FRESH( jrs.meta ),
|
meta: meta( true, src.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: {
|
location: {
|
||||||
city: jrs.basics.location.city,
|
city: src.basics.location.city,
|
||||||
region: jrs.basics.location.region,
|
region: src.basics.location.region,
|
||||||
country: jrs.basics.location.countryCode,
|
country: src.basics.location.countryCode,
|
||||||
code: jrs.basics.location.postalCode,
|
code: src.basics.location.postalCode,
|
||||||
address: jrs.basics.location.address
|
address: src.basics.location.address
|
||||||
},
|
},
|
||||||
|
|
||||||
employment: {
|
employment: {
|
||||||
history: jrs.work.map( function( job ) {
|
history: src.work.map( function( job ) {
|
||||||
return {
|
return {
|
||||||
position: job.position,
|
position: job.position,
|
||||||
employer: job.company,
|
employer: job.company,
|
||||||
summary: job.summary,
|
summary: job.summary,
|
||||||
current: !job.endDate || !job.endDate.trim() || job.endDate.trim().toLowerCase() === 'current',
|
current: (!job.endDate || !job.endDate.trim() || job.endDate.trim().toLowerCase() === 'current') || undefined,
|
||||||
start: job.startDate,
|
start: job.startDate,
|
||||||
end: job.endDate,
|
end: job.endDate,
|
||||||
url: job.website,
|
url: job.website,
|
||||||
@ -74,7 +64,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
},
|
},
|
||||||
|
|
||||||
education: {
|
education: {
|
||||||
history: jrs.education.map(function(edu){
|
history: src.education.map(function(edu){
|
||||||
return {
|
return {
|
||||||
institution: edu.institution,
|
institution: edu.institution,
|
||||||
start: edu.startDate,
|
start: edu.startDate,
|
||||||
@ -90,7 +80,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
},
|
},
|
||||||
|
|
||||||
service: {
|
service: {
|
||||||
history: jrs.volunteer.map(function(vol) {
|
history: src.volunteer.map(function(vol) {
|
||||||
return {
|
return {
|
||||||
type: 'volunteer',
|
type: 'volunteer',
|
||||||
position: vol.position,
|
position: vol.position,
|
||||||
@ -104,22 +94,20 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
skills: skillsToFRESH( jrs.skills ),
|
skills: skillsToFRESH( src.skills ),
|
||||||
|
|
||||||
writing: jrs.publications.map(function(pub){
|
writing: src.publications.map(function(pub){
|
||||||
return {
|
return {
|
||||||
title: pub.name,
|
title: pub.name,
|
||||||
|
flavor: undefined,
|
||||||
publisher: pub.publisher,
|
publisher: pub.publisher,
|
||||||
link: [
|
url: pub.website,
|
||||||
{ 'url': pub.website }
|
|
||||||
],
|
|
||||||
year: pub.releaseDate,
|
|
||||||
date: pub.releaseDate,
|
date: pub.releaseDate,
|
||||||
summary: pub.summary
|
summary: pub.summary
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
recognition: jrs.awards.map(function(awd){
|
recognition: src.awards.map(function(awd){
|
||||||
return {
|
return {
|
||||||
title: awd.title,
|
title: awd.title,
|
||||||
date: awd.date,
|
date: awd.date,
|
||||||
@ -129,7 +117,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
social: jrs.basics.profiles.map(function(pro){
|
social: src.basics.profiles.map(function(pro){
|
||||||
return {
|
return {
|
||||||
label: pro.network,
|
label: pro.network,
|
||||||
network: pro.network,
|
network: pro.network,
|
||||||
@ -138,37 +126,41 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
interests: jrs.interests,
|
interests: src.interests,
|
||||||
|
references: src.references,
|
||||||
references: jrs.references,
|
languages: src.languages,
|
||||||
|
disposition: src.disposition // <--> round-trip
|
||||||
languages: jrs.languages
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert from FRESH format to JSON Resume.
|
Convert from FRESH format to JSON Resume.
|
||||||
|
@param foreign True if non-JSON-Resume properties should be included in
|
||||||
|
the result, false if those properties should be excluded.
|
||||||
*/
|
*/
|
||||||
toJRS: function( fresh ) {
|
toJRS: function( src, foreign ) {
|
||||||
|
|
||||||
|
foreign = (foreign === undefined || foreign === null) ? false : foreign;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
basics: {
|
basics: {
|
||||||
name: fresh.name,
|
name: src.name,
|
||||||
label: fresh.info.label,
|
label: src.info.label,
|
||||||
summary: fresh.info.brief,
|
class: foreign ? src.info.class : undefined,
|
||||||
website: fresh.contact.website,
|
summary: src.info.brief,
|
||||||
phone: fresh.contact.phone,
|
website: src.contact.website,
|
||||||
email: fresh.contact.email,
|
phone: src.contact.phone,
|
||||||
picture: fresh.info.image,
|
email: src.contact.email,
|
||||||
|
picture: src.info.image,
|
||||||
location: {
|
location: {
|
||||||
address: fresh.location.address,
|
address: src.location.address,
|
||||||
postalCode: fresh.location.code,
|
postalCode: src.location.code,
|
||||||
city: fresh.location.city,
|
city: src.location.city,
|
||||||
countryCode: fresh.location.country,
|
countryCode: src.location.country,
|
||||||
region: fresh.location.region
|
region: src.location.region
|
||||||
},
|
},
|
||||||
profiles: fresh.social.map(function(soc){
|
profiles: src.social.map(function(soc){
|
||||||
return {
|
return {
|
||||||
network: soc.network,
|
network: soc.network,
|
||||||
username: soc.user,
|
username: soc.user,
|
||||||
@ -177,7 +169,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
work: fresh.employment.history.map(function(emp){
|
work: src.employment.history.map(function(emp){
|
||||||
return {
|
return {
|
||||||
company: emp.employer,
|
company: emp.employer,
|
||||||
website: emp.url,
|
website: emp.url,
|
||||||
@ -189,7 +181,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
education: fresh.education.history.map(function(edu){
|
education: src.education.history.map(function(edu){
|
||||||
return {
|
return {
|
||||||
institution: edu.institution,
|
institution: edu.institution,
|
||||||
gpa: edu.grade,
|
gpa: edu.grade,
|
||||||
@ -201,11 +193,11 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
skills: skillsToJRS( fresh.skills ),
|
skills: skillsToJRS( src.skills ),
|
||||||
|
|
||||||
volunteer: fresh.service.history.map(function(srv){
|
volunteer: src.service.history.map(function(srv){
|
||||||
return {
|
return {
|
||||||
//???: srv.type,
|
flavor: foreign ? srv.flavor : undefined,
|
||||||
organization: srv.organization,
|
organization: srv.organization,
|
||||||
position: srv.position,
|
position: srv.position,
|
||||||
startDate: srv.start,
|
startDate: srv.start,
|
||||||
@ -216,10 +208,10 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
awards: fresh.recognition.map(function(awd){
|
awards: src.recognition.map(function(awd){
|
||||||
return {
|
return {
|
||||||
//???: awd.type, // TODO
|
flavor: foreign ? awd.type : undefined,
|
||||||
//???: awd.url,
|
url: foreign ? awd.url: undefined,
|
||||||
title: awd.title,
|
title: awd.title,
|
||||||
date: awd.date,
|
date: awd.date,
|
||||||
awarder: awd.from,
|
awarder: awd.from,
|
||||||
@ -227,21 +219,21 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
publications: fresh.writing.map(function(pub){
|
publications: src.writing.map(function(pub){
|
||||||
return {
|
return {
|
||||||
name: pub.title,
|
name: pub.title,
|
||||||
publisher: pub.publisher,
|
publisher: pub.publisher,
|
||||||
releaseDate: pub.date,
|
releaseDate: pub.date,
|
||||||
website: pub.link[0].url,
|
website: pub.url,
|
||||||
summary: pub.summary
|
summary: pub.summary
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
interests: fresh.interests,
|
interests: src.interests,
|
||||||
|
references: src.references,
|
||||||
references: fresh.references,
|
samples: foreign ? src.samples : undefined,
|
||||||
|
disposition: foreign ? src.disposition : undefined,
|
||||||
languages: fresh.languages
|
languages: src.languages
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -249,10 +241,12 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function meta2FRESH( obj ) {
|
function meta( direction, obj ) {
|
||||||
|
if( direction ) {
|
||||||
obj = obj || { };
|
obj = obj || { };
|
||||||
obj.format = obj.format || "FRESH@0.1.0";
|
obj.format = obj.format || "FRESH@0.1.0";
|
||||||
obj.version = obj.version || "0.1.0";
|
obj.version = obj.version || "0.1.0";
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user