mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-12-23 05:37:23 +00:00
Scrub.
This commit is contained in:
parent
9d75b207d1
commit
40e71238ac
@ -1,11 +1,15 @@
|
||||
/**
|
||||
Definition of the FRESHResume class.
|
||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
|
||||
@license MIT. See LICENSE .md for details.
|
||||
@module fresh-resume.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
var FS = require('fs')
|
||||
, extend = require('../utils/extend')
|
||||
, validator = require('is-my-json-valid')
|
||||
@ -18,14 +22,19 @@ Definition of the FRESHResume class.
|
||||
, CONVERTER = require('./convert')
|
||||
, JRSResume = require('./jrs-resume');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
A FRESH-style resume in JSON or YAML.
|
||||
A FRESH resume or CV. FRESH resumes are backed by JSON, and each FreshResume
|
||||
object is an instantiation of that JSON decorated with utility methods.
|
||||
@class FreshResume
|
||||
*/
|
||||
function FreshResume() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Open and parse the specified FRESH resume sheet. Merge the JSON object model
|
||||
onto this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
@ -37,6 +46,8 @@ Definition of the FRESHResume class.
|
||||
return this.parse( this.imp.raw, title );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Save the sheet to disk (for environments that have disk access).
|
||||
*/
|
||||
@ -46,6 +57,8 @@ Definition of the FRESHResume class.
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Save the sheet to disk in a specific format, either FRESH or JSON Resume.
|
||||
*/
|
||||
@ -62,12 +75,19 @@ Definition of the FRESHResume class.
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Duplicate this FreshResume instance.
|
||||
*/
|
||||
FreshResume.prototype.dupe = function() {
|
||||
var rnew = new FreshResume();
|
||||
rnew.parse( this.stringify(), { } );
|
||||
return rnew;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Convert the supplied object to a JSON string, sanitizing meta-properties along
|
||||
the way.
|
||||
@ -82,6 +102,8 @@ Definition of the FRESHResume class.
|
||||
return JSON.stringify( obj, replacer, 2 );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create a copy of this resume in which all string fields have been run through
|
||||
a transformation function (such as a Markdown filter or XML encoder).
|
||||
@ -128,6 +150,8 @@ Definition of the FRESHResume class.
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create a copy of this resume in which all fields have been interpreted as
|
||||
Markdown.
|
||||
@ -148,6 +172,8 @@ Definition of the FRESHResume class.
|
||||
return this.transformStrings( ['skills','url','start','end','date'], trx );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create a copy of this resume in which all fields have been interpreted as
|
||||
Markdown.
|
||||
@ -161,6 +187,8 @@ Definition of the FRESHResume class.
|
||||
return this.transformStrings( [], trx );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Convert this object to a JSON string, sanitizing meta-properties along the
|
||||
way. Don't override .toString().
|
||||
@ -169,6 +197,8 @@ Definition of the FRESHResume class.
|
||||
return FreshResume.stringify( this );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the FreshResume from JSON data.
|
||||
Open and parse the specified FRESH resume. Merge the JSON object model onto
|
||||
@ -202,6 +232,8 @@ Definition of the FRESHResume class.
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return the resume format.
|
||||
*/
|
||||
@ -209,6 +241,8 @@ Definition of the FRESHResume class.
|
||||
return 'FRESH';
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the the FreshResume from string data.
|
||||
*/
|
||||
@ -216,6 +250,8 @@ Definition of the FRESHResume class.
|
||||
return this.parseJSON( JSON.parse( stringData ), opts );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return internal metadata. Create if it doesn't exist.
|
||||
*/
|
||||
@ -224,6 +260,8 @@ Definition of the FRESHResume class.
|
||||
return this.imp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return a unique list of all keywords across all skills.
|
||||
*/
|
||||
@ -235,13 +273,17 @@ Definition of the FRESHResume class.
|
||||
.reduce(function(a,b) { return a.concat(b); });
|
||||
}
|
||||
else if( this.skills.list ) {
|
||||
flatSkills = flatSkills.concat( this.skills.list.map(function(sk) { return sk.name; }) );
|
||||
flatSkills = flatSkills.concat( this.skills.list.map(function(sk) {
|
||||
return sk.name;
|
||||
}));
|
||||
}
|
||||
flatSkills = _.uniq( flatSkills );
|
||||
}
|
||||
return flatSkills;
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Reset the sheet to an empty state.
|
||||
*/
|
||||
@ -260,6 +302,8 @@ Definition of the FRESHResume class.
|
||||
delete this.social;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get a safe count of the number of things in a section.
|
||||
*/
|
||||
@ -270,6 +314,8 @@ Definition of the FRESHResume class.
|
||||
return obj.length || 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get the default (empty) sheet.
|
||||
*/
|
||||
@ -277,6 +323,8 @@ Definition of the FRESHResume class.
|
||||
return new FreshResume().parseJSON( require('fresh-resume-empty') );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Add work experience to the sheet.
|
||||
*/
|
||||
@ -297,6 +345,7 @@ Definition of the FRESHResume class.
|
||||
return newObject;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific social profile (eg, GitHub).
|
||||
*/
|
||||
@ -307,6 +356,8 @@ Definition of the FRESHResume class.
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return the specified network profile.
|
||||
*/
|
||||
@ -317,6 +368,8 @@ Definition of the FRESHResume class.
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return an array of profiles for the specified network, for when the user
|
||||
has multiple eg. GitHub accounts.
|
||||
@ -328,6 +381,8 @@ Definition of the FRESHResume class.
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific skill.
|
||||
*/
|
||||
@ -340,6 +395,8 @@ Definition of the FRESHResume class.
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Validate the sheet against the FRESH Resume schema.
|
||||
*/
|
||||
@ -357,6 +414,8 @@ Definition of the FRESHResume class.
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Calculate the total duration of the sheet. Assumes this.work has been sorted
|
||||
by start date descending, perhaps via a call to Sheet.sort().
|
||||
@ -382,6 +441,8 @@ Definition of the FRESHResume class.
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Sort dated things on the sheet by start date descending. Assumes that dates
|
||||
on the sheet have been processed with _parseDates().
|
||||
@ -414,11 +475,10 @@ Definition of the FRESHResume class.
|
||||
return( a.safe.date.isBefore(b.safe.date) ) ? 1
|
||||
: ( a.safe.date.isAfter(b.safe.date) && -1 ) || 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Convert human-friendly dates into formal Moment.js dates for all collections.
|
||||
We don't want to lose the raw textual date as entered by the user, so we store
|
||||
@ -464,11 +524,15 @@ Definition of the FRESHResume class.
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Export the Sheet function/ctor.
|
||||
*/
|
||||
module.exports = FreshResume;
|
||||
|
||||
|
||||
|
||||
}());
|
||||
|
||||
// Note 1: Adjust default date validation to allow YYYY and YYYY-MM formats
|
||||
|
Loading…
Reference in New Issue
Block a user