mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Safer source format conversions.
Quick fix against missing fields in FRESH and/or JRS (ahead of introing more robust standalone converter thing). Address portions of #31 and #33.
This commit is contained in:
parent
358c397bb9
commit
5e7abb66bd
@ -16,6 +16,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
/**
|
/**
|
||||||
Convert from JSON Resume format to FRESH.
|
Convert from JSON Resume format to FRESH.
|
||||||
@method toFresh
|
@method toFresh
|
||||||
|
@todo Refactor
|
||||||
*/
|
*/
|
||||||
toFRESH: function( src, foreign ) {
|
toFRESH: function( src, foreign ) {
|
||||||
|
|
||||||
@ -67,6 +68,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
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
|
@param foreign True if non-JSON-Resume properties should be included in
|
||||||
the result, false if those properties should be excluded.
|
the result, false if those properties should be excluded.
|
||||||
|
@todo Refactor
|
||||||
*/
|
*/
|
||||||
toJRS: function( src, foreign ) {
|
toJRS: function( src, foreign ) {
|
||||||
|
|
||||||
@ -112,6 +114,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
};
|
};
|
||||||
|
|
||||||
function meta( direction, obj ) {
|
function meta( direction, obj ) {
|
||||||
|
if( !obj ) return obj; // preserve null and undefined
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
obj = obj || { };
|
obj = obj || { };
|
||||||
obj.format = obj.format || "FRESH@0.1.0";
|
obj.format = obj.format || "FRESH@0.1.0";
|
||||||
@ -121,6 +124,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function employment( obj, direction ) {
|
function employment( obj, direction ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( !direction ) {
|
if( !direction ) {
|
||||||
return obj && obj.history ?
|
return obj && obj.history ?
|
||||||
obj.history.map(function(emp){
|
obj.history.map(function(emp){
|
||||||
@ -157,6 +161,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
|
|
||||||
|
|
||||||
function education( obj, direction ) {
|
function education( obj, direction ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return obj && obj.length ? {
|
return obj && obj.length ? {
|
||||||
history: obj.map(function(edu){
|
history: obj.map(function(edu){
|
||||||
@ -191,6 +196,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function service( obj, direction, foreign ) {
|
function service( obj, direction, foreign ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return {
|
return {
|
||||||
history: obj && obj.length ? obj.map(function(vol) {
|
history: obj && obj.length ? obj.map(function(vol) {
|
||||||
@ -225,6 +231,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function social( obj, direction ) {
|
function social( obj, direction ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return obj.map(function(pro){
|
return obj.map(function(pro){
|
||||||
return {
|
return {
|
||||||
@ -247,6 +254,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function recognition( obj, direction, foreign ) {
|
function recognition( obj, direction, foreign ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return obj && obj.length ? obj.map(
|
return obj && obj.length ? obj.map(
|
||||||
function(awd){
|
function(awd){
|
||||||
@ -275,6 +283,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function references( obj, direction ) {
|
function references( obj, direction ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return obj && obj.length && obj.map(function(ref){
|
return obj && obj.length && obj.map(function(ref){
|
||||||
return {
|
return {
|
||||||
@ -296,6 +305,7 @@ FRESH to JSON Resume conversion routiens.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writing( obj, direction ) {
|
function writing( obj, direction ) {
|
||||||
|
if( !obj ) return obj;
|
||||||
if( direction ) {
|
if( direction ) {
|
||||||
return obj.map(function( pub ) {
|
return obj.map(function( pub ) {
|
||||||
return {
|
return {
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the theme
|
// Load the theme
|
||||||
var theTheme = new FluentTheme().open( tFolder );
|
var theTheme = (new FluentTheme()).open( tFolder );
|
||||||
_opts.themeObj = theTheme;
|
_opts.themeObj = theTheme;
|
||||||
_log( 'Applying '.info + theTheme.name.toUpperCase().infoBold +
|
_log( 'Applying '.info + theTheme.name.toUpperCase().infoBold +
|
||||||
(' theme (' + Object.keys(theTheme.formats).length + ' formats)').info);
|
(' theme (' + Object.keys(theTheme.formats).length + ' formats)').info);
|
||||||
|
Loading…
Reference in New Issue
Block a user