code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
parseJSON( rep, opts ) { let scrubbed; if (opts && opts.privatize) { // Ignore any element with the 'ignore: true' or 'private: true' designator. const scrubber = require('../utils/resume-scrubber'); var ret = scrubber.scrubResume(rep, opts); scrubbed = ret.scrubbed; } // Now a...
Initialize the FreshResume from JSON. Open and parse the specified FRESH resume. Merge the JSON object model onto this Sheet instance with extend() and convert sheet dates to a safe & consistent format. Then sort each section by startDate descending. @param rep {Object} The raw JSON representation. @param opt...
parseJSON
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
save( filename ) { this.imp.file = filename || this.imp.file; FS.writeFileSync(this.imp.file, this.stringify(), 'utf8'); return this; }
Save the sheet to disk (for environments that have disk access).
save
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
saveAs( filename, format ) { // If format isn't specified, default to FRESH const safeFormat = (format && format.trim()) || 'FRESH'; // Validate against the FRESH version regex // freshVersionReg = require '../utils/fresh-version-regex' // if (not freshVersionReg().test( safeFormat )) // thr...
Save the sheet to disk in a specific format, either FRESH or JSON Resume.
saveAs
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
dupe() { const jso = extend(true, { }, this); const rnew = new FreshResume(); rnew.parseJSON(jso, { }); return rnew; }
Duplicate this FreshResume instance. This method first extend()s this object onto an empty, creating a deep copy, and then passes the result into a new FreshResume instance via .parseJSON. We do it this way to create a true clone of the object without re-running any of the associated processing.
dupe
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
transformStrings( filt, transformer ) { const ret = this.dupe(); const trx = require('../utils/string-transformer'); return trx(ret, filt, transformer); }
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). TODO: Move this out of FRESHResume.
transformStrings
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
markdownify() { const MDIN = txt => MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, ''); const trx = function( key, val ) { if (key === 'summary') { return MD(val); } return MDIN(val); }; return this.transformStrings(['skills','url','start','end','date'], trx); }
Create a copy of this resume in which all fields have been interpreted as Markdown.
markdownify
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
trx = function( key, val ) { if (key === 'summary') { return MD(val); } return MDIN(val); }
Create a copy of this resume in which all fields have been interpreted as Markdown.
trx
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
trx = function( key, val ) { if (key === 'summary') { return MD(val); } return MDIN(val); }
Create a copy of this resume in which all fields have been interpreted as Markdown.
trx
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
xmlify() { const trx = (key, val) => XML(val); return this.transformStrings([], trx); }
Create a copy of this resume in which all fields have been interpreted as Markdown.
xmlify
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
keywords() { let flatSkills = []; if (this.skills) { if (this.skills.sets) { flatSkills = this.skills.sets.map(sk => sk.skills).reduce( (a,b) => a.concat(b)); } else if (this.skills.list) { flatSkills = flatSkills.concat( this.skills.list.map(sk => sk.name) ); } flatSkill...
Return a unique list of all skills declared in the resume.
keywords
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
clear( clearMeta ) { clearMeta = ((clearMeta === undefined) && true) || clearMeta; if (clearMeta) { delete this.imp; } delete this.computed; // Don't use Object.keys() here delete this.employment; delete this.service; delete this.education; delete this.recognition; delete this.reading; ...
Reset the sheet to an empty state. TODO: refactor/review
clear
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
count( obj ) { if (!obj) { return 0; } if (obj.history) { return obj.history.length; } if (obj.sets) { return obj.sets.length; } return obj.length || 0; }
Get a safe count of the number of things in a section.
count
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
add( moniker ) { const defSheet = FreshResume.default(); const newObject = defSheet[moniker].history ? extend( true, {}, defSheet[ moniker ].history[0] ) : moniker === 'skills' ? extend( true, {}, defSheet.skills.sets[0] ) : extend( true, {}, defSheet[ moniker ][0] ); ...
Add work experience to the sheet.
add
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
hasProfile( socialNetwork ) { socialNetwork = socialNetwork.trim().toLowerCase(); return this.social && _.some(this.social, p => p.network.trim().toLowerCase() === socialNetwork); }
Determine if the sheet includes a specific social profile (eg, GitHub).
hasProfile
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
getProfiles( socialNetwork ) { socialNetwork = socialNetwork.trim().toLowerCase(); return this.social && _.filter(this.social, sn => sn.network.trim().toLowerCase() === socialNetwork); }
Return an array of profiles for the specified network, for when the user has multiple eg. GitHub accounts.
getProfiles
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
hasSkill( skill ) { skill = skill.trim().toLowerCase(); return this.skills && _.some(this.skills, sk => sk.keywords && _.some(sk.keywords, kw => kw.trim().toLowerCase() === skill) ); }
Determine if the sheet includes a specific skill.
hasSkill
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
isValid() { const schemaObj = require('fresh-resume-schema'); validator = require('is-my-json-valid'); const validate = validator( schemaObj, { // See Note [1]. formats: { date: /^\d{4}(?:-(?:0[0-9]{1}|1[0-2]{1})(?:-[0-9]{2})?)?$/ } }); const ret = validate(this); if (!ret) { this.im...
Validate the sheet against the FRESH Resume schema.
isValid
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
duration(unit) { const inspector = require('../inspectors/duration-inspector'); return inspector.run(this, 'employment.history', 'start', 'end', unit); }
Validate the sheet against the FRESH Resume schema.
duration
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
sort() { const byDateDesc = function(a,b) { if (a.safe.start.isBefore(b.safe.start)) { return 1; } else { if (a.safe.start.isAfter(b.safe.start)) { return -1; } else { return 0; } } }; const sortSection = function( key ) { const ar = __.get(this, key); if (ar && ar.length) ...
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
sort
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
byDateDesc = function(a,b) { if (a.safe.start.isBefore(b.safe.start)) { return 1; } else { if (a.safe.start.isAfter(b.safe.start)) { return -1; } else { return 0; } } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
byDateDesc
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
byDateDesc = function(a,b) { if (a.safe.start.isBefore(b.safe.start)) { return 1; } else { if (a.safe.start.isAfter(b.safe.start)) { return -1; } else { return 0; } } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
byDateDesc
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
sortSection = function( key ) { const ar = __.get(this, key); if (ar && ar.length) { const datedThings = ar.filter(o => o.start); return datedThings.sort( byDateDesc ); } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
sortSection
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
sortSection = function( key ) { const ar = __.get(this, key); if (ar && ar.length) { const datedThings = ar.filter(o => o.start); return datedThings.sort( byDateDesc ); } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
sortSection
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
replacer = function( key,value ) { // Exclude these keys from stringification const exKeys = ['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safe', 'result', 'isModified', 'htmlPreview', 'display_progress_bar']; if (_.some( exKeys, val => key.trim() === val)) { return undefined; } else { ret...
Convert the supplied FreshResume to a JSON string, sanitizing meta-properties along the way.
replacer
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
replacer = function( key,value ) { // Exclude these keys from stringification const exKeys = ['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safe', 'result', 'isModified', 'htmlPreview', 'display_progress_bar']; if (_.some( exKeys, val => key.trim() === val)) { return undefined; } else { ret...
Convert the supplied FreshResume to a JSON string, sanitizing meta-properties along the way.
replacer
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
_parseDates = function() { const _fmt = require('./fluent-date').fmt; const that = this; // TODO: refactor recursion var replaceDatesInObject = function( obj ) { if (!obj) { return; } if (Object.prototype.toString.call( obj ) === '[object Array]') { obj.forEach(elem => replaceDatesInObject( ele...
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 the Moment-ified date as a separate property with a prefix of .safe. For ex: job.startDate is the date as entered by the user. job.safeStartDate is the parsed Mome...
_parseDates
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
replaceDatesInObject = function( obj ) { if (!obj) { return; } if (Object.prototype.toString.call( obj ) === '[object Array]') { obj.forEach(elem => replaceDatesInObject( elem )); return; } else if (typeof obj === 'object') { if (obj._isAMomentObject || obj.safe) { return; }...
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 the Moment-ified date as a separate property with a prefix of .safe. For ex: job.startDate is the date as entered by the user. job.safeStartDate is the parsed Mome...
replaceDatesInObject
javascript
hacksalot/HackMyResume
src/core/fresh-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js
MIT
static initClass() { /** Reset the sheet to an empty state. */ // clear = function( clearMeta ) { // clearMeta = ((clearMeta === undefined) && true) || clearMeta; // if (clearMeta) { delete this.imp; } // delete this.basics.computed; // Don't use Object.keys() here // delete this.work; ...
A JRS resume or CV. JRS resumes are backed by JSON, and each JRSResume object is an instantiation of that JSON decorated with utility methods. @class JRSResume
initClass
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
parse( stringData, opts ) { this.imp = this.imp != null ? this.imp : {raw: stringData}; return this.parseJSON(JSON.parse( stringData ), opts); }
Initialize the the JSResume from string.
parse
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
parseJSON( rep, opts ) { let scrubbed; opts = opts || { }; if (opts.privatize) { const scrubber = require('../utils/resume-scrubber'); // Ignore any element with the 'ignore: true' or 'private: true' designator. var ret = scrubber.scrubResume(rep, opts); scrubbed = ret.scrubbed; ...
Initialize the JRSResume object from JSON. Open and parse the specified JRS resume. Merge the JSON object model onto this Sheet instance with extend() and convert sheet dates to a safe & consistent format. Then sort each section by startDate descending. @param rep {Object} The raw JSON representation. @param ...
parseJSON
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
save( filename ) { this.imp.file = filename || this.imp.file; FS.writeFileSync(this.imp.file, this.stringify( this ), 'utf8'); return this; }
Save the sheet to disk (for environments that have disk access).
save
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
saveAs( filename, format ) { if (format === 'JRS') { this.imp.file = filename || this.imp.file; FS.writeFileSync( this.imp.file, this.stringify(), 'utf8' ); } else { const newRep = CONVERTER.toFRESH(this); const stringRep = CONVERTER.toSTRING(newRep); FS.writeFileSync(filename, str...
Save the sheet to disk in a specific format, either FRESH or JRS.
saveAs
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
keywords() { let flatSkills = []; if (this.skills && this.skills.length) { this.skills.forEach( s => flatSkills = _.union(flatSkills, s.keywords)); } return flatSkills; }
Return a unique list of all keywords across all skills.
keywords
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
i() { return this.imp = this.imp != null ? this.imp : { }; }
Return internal metadata. Create if it doesn't exist. JSON Resume v0.0.0 doesn't allow additional properties at the root level, so tuck this into the .basic sub-object.
i
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
add( moniker ) { const defSheet = JRSResume.default(); const newObject = extend( true, {}, defSheet[ moniker ][0] ); this[ moniker ] = this[ moniker ] || []; this[ moniker ].push( newObject ); return newObject; }
Add work experience to the sheet.
add
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
hasProfile( socialNetwork ) { socialNetwork = socialNetwork.trim().toLowerCase(); return this.basics.profiles && _.some(this.basics.profiles, p => p.network.trim().toLowerCase() === socialNetwork); }
Determine if the sheet includes a specific social profile (eg, GitHub).
hasProfile
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
hasSkill( skill ) { skill = skill.trim().toLowerCase(); return this.skills && _.some(this.skills, sk => sk.keywords && _.some(sk.keywords, kw => kw.trim().toLowerCase() === skill) ); }
Determine if the sheet includes a specific skill.
hasSkill
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
duration(unit) { const inspector = require('../inspectors/duration-inspector'); return inspector.run(this, 'work', 'startDate', 'endDate', unit); }
Validate the sheet against the JSON Resume schema.
duration
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
sort( ) { const byDateDesc = function(a,b) { if (a.safeStartDate.isBefore(b.safeStartDate)) { return 1; } else { return ( a.safeStartDate.isAfter(b.safeStartDate) && -1 ) || 0; } }; this.work && this.work.sort(byDateDesc); this.education && this.education.sort(byDateDesc); this.v...
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
sort
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
byDateDesc = function(a,b) { if (a.safeStartDate.isBefore(b.safeStartDate)) { return 1; } else { return ( a.safeStartDate.isAfter(b.safeStartDate) && -1 ) || 0; } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
byDateDesc
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
byDateDesc = function(a,b) { if (a.safeStartDate.isBefore(b.safeStartDate)) { return 1; } else { return ( a.safeStartDate.isAfter(b.safeStartDate) && -1 ) || 0; } }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
byDateDesc
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
dupe() { const rnew = new JRSResume(); rnew.parse(this.stringify(), { }); return rnew; }
Sort dated things on the sheet by start date descending. Assumes that dates on the sheet have been processed with _parseDates().
dupe
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
harden() { const ret = this.dupe(); const HD = txt => `@@@@~${txt}~@@@@`; // const HDIN = txt => // //return MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, ''); // HD(txt) // ; const transformer = require('../utils/string-transformer'); return transformer(ret, [ 'skills','ur...
Create a copy of this resume in which all fields have been interpreted as Markdown.
harden
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
replacer = function( key,value ) { // Exclude these keys from stringification const temp = _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result', 'isModified', 'htmlPreview', 'display_progress_bar'], val => key.tri...
Convert this object to a JSON string, sanitizing meta-properties along the way. Don't override .toString().
replacer
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
replacer = function( key,value ) { // Exclude these keys from stringification const temp = _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result', 'isModified', 'htmlPreview', 'display_progress_bar'], val => key.tri...
Convert this object to a JSON string, sanitizing meta-properties along the way. Don't override .toString().
replacer
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
_parseDates = function() { const _fmt = require('./fluent-date').fmt; this.work && this.work.forEach(function(job) { job.safeStartDate = _fmt( job.startDate ); return job.safeEndDate = _fmt( job.endDate ); }); this.education && this.education.forEach(function(edu) { edu.safeStartDate = _fmt( edu.s...
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 the Moment-ified date as a separate property with a prefix of .safe. For ex: job.startDate is the date as entered by the user. job.safeStartDate is the parsed Mome...
_parseDates
javascript
hacksalot/HackMyResume
src/core/jrs-resume.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-resume.js
MIT
open( thFolder ) { this.folder = thFolder; //const pathInfo = parsePath(thFolder); // Open and parse the theme's package.json file const pkgJsonPath = PATH.join(thFolder, 'package.json'); if (pathExists(pkgJsonPath)) { const thApi = require(thFolder); // Requiring the folder yields whate...
Open and parse the specified JRS theme. @method open
open
javascript
hacksalot/HackMyResume
src/core/jrs-theme.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/jrs-theme.js
MIT
load( sources, opts, emitter ) { return sources.map( function(src) { return this.loadOne( src, opts, emitter ); } , this); }
Load one or more resumes from disk. @param {Object} opts An options object with settings for the factory as well as passthrough settings for FRESHResume or JRSResume. Structure: { format: 'FRESH', // Format to open as. ('FRESH', 'JRS', null) objectify: true, // FRESH/JRSResume or raw J...
load
javascript
hacksalot/HackMyResume
src/core/resume-factory.js
https://github.com/hacksalot/HackMyResume/blob/master/src/core/resume-factory.js
MIT
static initClass() { /** Status codes. */ this.prototype.codes = require('../core/status-codes'); /** Generator options. */ this.prototype.opts = { }; }
The BaseGenerator class is the root of the generator hierarchy. Functionality common to ALL generators lives here.
initClass
javascript
hacksalot/HackMyResume
src/generators/base-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/base-generator.js
MIT
onBeforeSave( info ) { if (info.outputFile.endsWith('.css')) { return info.mk; } if (this.opts.prettify) { return HTML.prettyPrint(info.mk, this.opts.prettify); } else { return info.mk; } }
Copy satellite CSS files to the destination and optionally pretty-print the HTML resume prior to saving.
onBeforeSave
javascript
hacksalot/HackMyResume
src/generators/html-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-generator.js
MIT
wkhtmltopdf(markup, fOut, opts, on_error) { // Save the markup to a temporary file const tempFile = fOut.replace(/\.pdf$/i, '.pdf.html'); FS.writeFileSync(tempFile, markup, 'utf8'); // Prepare wkhtmltopdf arguments. let wkopts = _.extend({'margin-top': '10mm', 'margin-bottom': '10mm'}, opts.wkhtmlt...
Generate a PDF from HTML using wkhtmltopdf's CLI interface. Spawns a child process with `wkhtmltopdf <source> <target>`. wkhtmltopdf must be installed and path-accessible. TODO: If HTML generation has run, reuse that output TODO: Local web server to ease wkhtmltopdf rendering
wkhtmltopdf
javascript
hacksalot/HackMyResume
src/generators/html-pdf-cli-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-pdf-cli-generator.js
MIT
phantomjs( markup, fOut, opts, on_error ) { // Save the markup to a temporary file const tempFile = fOut.replace(/\.pdf$/i, '.pdf.html'); FS.writeFileSync(tempFile, markup, 'utf8'); let scriptPath = PATH.relative(process.cwd(), PATH.resolve( __dirname, '../utils/rasterize.js' )); scriptPath = SLASH(...
Generate a PDF from HTML using Phantom's CLI interface. Spawns a child process with `phantomjs <script> <source> <target>`. Phantom must be installed and path-accessible. TODO: If HTML generation has run, reuse that output TODO: Local web server to ease Phantom rendering
phantomjs
javascript
hacksalot/HackMyResume
src/generators/html-pdf-cli-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-pdf-cli-generator.js
MIT
weasyprint( markup, fOut, opts, on_error ) { // Save the markup to a temporary file const tempFile = fOut.replace(/\.pdf$/i, '.pdf.html'); FS.writeFileSync(tempFile, markup, 'utf8'); SPAWN('weasyprint', [tempFile, fOut], false, on_error, this); }
Generate a PDF from HTML using WeasyPrint's CLI interface. Spawns a child process with `weasyprint <source> <target>`. Weasy Print must be installed and path-accessible. TODO: If HTML generation has run, reuse that output
weasyprint
javascript
hacksalot/HackMyResume
src/generators/html-pdf-cli-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-pdf-cli-generator.js
MIT
function __guardMethod__(obj, methodName, transform) { if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') { return transform(obj, methodName); } else { return undefined; } }
Generate a PDF from HTML using WeasyPrint's CLI interface. Spawns a child process with `weasyprint <source> <target>`. Weasy Print must be installed and path-accessible. TODO: If HTML generation has run, reuse that output
__guardMethod__
javascript
hacksalot/HackMyResume
src/generators/html-pdf-cli-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-pdf-cli-generator.js
MIT
generate( rez, f, opts ) { const htmlResults = opts.targets.filter(t => t.fmt.outFormat === 'html'); const htmlFile = htmlResults[0].final.files.filter(fl => fl.info.ext === 'html'); phantom(htmlFile[0].data, f); }
An HTML-based PNG resume generator for HackMyResume.
generate
javascript
hacksalot/HackMyResume
src/generators/html-png-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-png-generator.js
MIT
phantom = function( markup, fOut ) { // Save the markup to a temporary file const tempFile = fOut.replace(/\.png$/i, '.png.html'); FS.writeFileSync(tempFile, markup, 'utf8'); const scriptPath = SLASH( PATH.relative( process.cwd(), PATH.resolve( __dirname, '../utils/rasterize.js' ) ) ); const sourcePath =...
Generate a PDF from HTML using Phantom's CLI interface. Spawns a child process with `phantomjs <script> <source> <target>`. Phantom must be installed and path-accessible. TODO: If HTML generation has run, reuse that output TODO: Local web server to ease Phantom rendering
phantom
javascript
hacksalot/HackMyResume
src/generators/html-png-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/html-png-generator.js
MIT
invoke( rez ) { let altRez = FJCV[ `to${rez.format() === 'FRESH' ? 'JRS' : 'FRESH'}` ](rez); return altRez = FJCV.toSTRING( altRez ); }
The JsonGenerator generates a FRESH or JRS resume as an output.
invoke
javascript
hacksalot/HackMyResume
src/generators/json-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/json-generator.js
MIT
generate( rez, f ) { FS.writeFileSync(f, this.invoke(rez), 'utf8'); }
The JsonGenerator generates a FRESH or JRS resume as an output.
generate
javascript
hacksalot/HackMyResume
src/generators/json-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/json-generator.js
MIT
invoke( rez/*, themeMarkup, cssInfo, opts*/ ) { return YAML.stringify(JSON.parse( rez.stringify() ), Infinity, 2); }
JsonYamlGenerator takes a JSON resume object and translates it directly to JSON without a template, producing an equivalent YAML-formatted resume. See also YamlGenerator (yaml-generator.js).
invoke
javascript
hacksalot/HackMyResume
src/generators/json-yaml-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/json-yaml-generator.js
MIT
generate( rez, f/*, opts */) { const data = YAML.stringify(JSON.parse( rez.stringify() ), Infinity, 2); FS.writeFileSync(f, data, 'utf8'); return data; }
JsonYamlGenerator takes a JSON resume object and translates it directly to JSON without a template, producing an equivalent YAML-formatted resume. See also YamlGenerator (yaml-generator.js).
generate
javascript
hacksalot/HackMyResume
src/generators/json-yaml-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/json-yaml-generator.js
MIT
constructor( outputFormat, templateFormat/*, cssFile */) { super(outputFormat); this.tplFormat = templateFormat || outputFormat; }
Constructor. Set the output format and template format for this generator. Will usually be called by a derived generator such as HTMLGenerator or MarkdownGenerator.
constructor
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
invoke( rez, opts ) { opts = opts ? (this.opts = EXTEND( true, { }, _defaultOpts, opts )) : this.opts; // Sort such that CSS files are processed before others const curFmt = opts.themeObj.getFormat( this.format ); curFmt.files = _.sortBy(curFmt.files, fi => fi.ext !== 'css'); //...
Generate a resume using string-based inputs and outputs without touching the filesystem. @method invoke @param rez A FreshResume object. @param opts Generator options. @returns {Array} An array of objects representing the generated output files.
invoke
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
generate( rez, f, opts ) { // Prepare this.opts = EXTEND(true, { }, _defaultOpts, opts); // Call the string-based generation method const genInfo = this.invoke(rez, null); const outFolder = parsePath( f ).dirname; const curFmt = opts.themeObj.getFormat(this.format); // Process individual ...
Generate a resume using file-based inputs and outputs. Requires access to the local filesystem. @method generate @param rez A FreshResume object. @param f Full path to the output resume file to generate. @param opts Generator options.
generate
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
transform( json, jst, format, opts, theme, curFmt ) { if (this.opts.freezeBreaks) { jst = freeze(jst); } const eng = require(`../renderers/${theme.engine}-generator`); let result = eng.generate(json, jst, format, curFmt, opts, theme); if (this.opts.freezeBreaks) { result = unfreeze(resul...
Perform a single resume resume transformation using string-based inputs and outputs without touching the local file system. @param json A FRESH or JRS resume object. @param jst The stringified template data @param format The format name, such as "html" or "latex" @param cssInfo Needs to be refactored. @para...
transform
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
createSymLinks = function( curFmt, outFolder ) { // Some themes require a symlink structure. If so, create it. if (curFmt.symLinks) { Object.keys( curFmt.symLinks ).forEach(function(loc) { const absLoc = PATH.join(outFolder, loc); const absTarg = PATH.join(PATH.dirname(absLoc), curFmt.symLinks[loc])...
Perform a single resume resume transformation using string-based inputs and outputs without touching the local file system. @param json A FRESH or JRS resume object. @param jst The stringified template data @param format The format name, such as "html" or "latex" @param cssInfo Needs to be refactored. @para...
createSymLinks
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
freeze = function( markup ) { markup.replace( _reg.regN, _defaultOpts.nSym ); return markup.replace( _reg.regR, _defaultOpts.rSym ); }
Freeze newlines for protection against errant JST parsers.
freeze
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
unfreeze = function( markup ) { markup.replace(_reg.regSymR, '\r'); return markup.replace(_reg.regSymN, '\n'); }
Unfreeze newlines when the coast is clear.
unfreeze
javascript
hacksalot/HackMyResume
src/generators/template-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/generators/template-generator.js
MIT
dateRange( obj, fmt, sep, fallback ) { if (!obj) { return ''; } return _fromTo(obj.start, obj.end, fmt, sep, fallback); }
Given a resume sub-object with a start/end date, format a representation of the date range.
dateRange
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
color( colorName, colorDefault ) { // Key must be specified if (!(colorName && colorName.trim())) { return _reportError(HMSTATUS.invalidHelperUse, {helper: 'fontList', error: HMSTATUS.missingParam, expected: 'name'}); } else { if (!GenericHelpers.theme.colors) { return colorDefault; } ...
Return a named color value as an RRGGBB string. @method toFrom
color
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
camelCase(val) { val = (val && val.trim()) || ''; if (val) { return (val.charAt(0).toUpperCase() + val.slice(1)); } else { return val; } }
Capitalize the first letter of the word. TODO: Rename @method section
camelCase
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
sectionTitle( sname, stitle ) { // If not provided by the user, stitle should default to sname. ps. // Handlebars silently passes in the options object to the last param, // where in Underscore stitle will be null/undefined, so we check both. // TODO: not actually sure that's true, given that we _.wrap...
Display a user-overridable section title for a FRESH resume theme. Use this in lieue of hard-coding section titles. Usage: {{sectionTitle "sectionName"}} {{sectionTitle "sectionName" "sectionTitle"}} Example: {{sectionTitle "Education"}} {{sectionTitle "Employment" "Project History"}} ...
sectionTitle
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
wpml( txt, inline ) { if (!txt) { return ''; } inline = (inline && !inline.hash) || false; txt = XML(txt.trim()); txt = inline ? MD(txt).replace(/^\s*<p>|<\/p>\s*$/gi, '') : MD(txt); txt = H2W( txt ); return txt; }
Convert inline Markdown to inline WordProcessingML.
wpml
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
lastWord( txt ) { if (txt && txt.trim()) { return _.last( txt.split(' ') ); } else { return ''; } }
Return the last word of the specified text. @method lastWord
lastWord
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
skillColor( lvl ) { const idx = _skillLevelToIndex(lvl); const skillColors = (this.theme && this.theme.palette && this.theme.palette.skillLevels) || [ '#FFFFFF', '#5CB85C', '#F1C40F', '#428BCA', '#C00000' ]; return skillColors[idx]; }
Convert a skill level to an RGB color triplet. TODO: refactor @method skillColor @param lvl Input skill level. Skill level can be expressed as a string ("beginner", "intermediate", etc.), as an integer (1,5,etc), as a string integer ("1", "5", etc.), or as an RRGGBB color triplet ('#C00000', '#FFFFAA').
skillColor
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
skillHeight( lvl ) { const idx = _skillLevelToIndex(lvl); return ['38.25', '30', '16', '8', '0'][idx]; }
Return an appropriate height. TODO: refactor @method lastWord
skillHeight
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
initialWords( txt ) { if (txt && txt.trim()) { return _.initial( txt.split(' ') ).join(' '); } else { return ''; } }
Return all but the last word of the input text. @method initialWords
initialWords
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
trimURL( url ) { if (url && url.trim()) { return url.trim().replace(/^https?:\/\//i, ''); } else { return ''; } }
Trim the protocol (http or https) from a URL/ @method trimURL
trimURL
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
compare(lvalue, rvalue, options) { if (arguments.length < 3) { throw new Error('Template helper \'compare\' needs 2 parameters'); } const operator = options.hash.operator || '=='; const operators = { '=='(l,r) { return l === r; }, '==='(l,r) { return l === r; }, '!='(l,r) {...
Perform a generic comparison. See: http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates @method compare
compare
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
skillYears( skill, rez ) { const sk = _.find(rez.skills.list, sk => sk.name.toUpperCase() === skill.toUpperCase()); if (sk) { return sk.years; } else { return '?'; } }
Given the name of a skill ("JavaScript" or "HVAC repair"), return the number of years assigned to that skill in the resume.skills.list collection.
skillYears
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
stringOrObject( obj, objPath/*, rez */) { if (_.isString(obj)) { return obj; } else { return LO.get(obj, objPath); } }
Given an object that may be a string or an object, return it as-is if it's a string, otherwise return the value at obj[objPath].
stringOrObject
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
_skillLevelToIndex = function( lvl ) { let idx = 0; if (String.is( lvl )) { lvl = lvl.trim().toLowerCase(); const intVal = parseInt( lvl ); if (isNaN(intVal)) { switch (lvl) { case 'beginner': idx = 1; break; case 'intermediate': idx = 2; break; case 'advanced': idx = 3; br...
Format a from/to date range for display.
_skillLevelToIndex
javascript
hacksalot/HackMyResume
src/helpers/generic-helpers.js
https://github.com/hacksalot/HackMyResume/blob/master/src/helpers/generic-helpers.js
MIT
run(rez, collKey, startKey, endKey, unit) { unit = unit || 'years'; const hist = lo.get(rez, collKey); if (!hist || !hist.length) { return 0; } // BEGIN CODE DUPLICATION --> src/inspectors/gap-inspector.coffee (TODO) // Convert the candidate's employment history to an array of dates, // where ...
Compute the total duration of the work history. @returns The total duration of the sheet's work history, that is, the number of years between the start date of the earliest job on the resume and the latest end date of all jobs in the work history*. This last condition is for sheets that have overlapping jobs.
run
javascript
hacksalot/HackMyResume
src/inspectors/duration-inspector.js
https://github.com/hacksalot/HackMyResume/blob/master/src/inspectors/duration-inspector.js
MIT
run(rez) { // This is what we'll return const coverage = { gaps: [], overlaps: [], pct: '0%', duration: { total: 0, work: 0, gaps: 0 } }; // Missing employment section? Bye bye. const hist = LO.get(rez, 'employment.history'); if (!hist || ...
Run the Gap Analyzer on a resume. @method run @return {Array} An array of object representing gaps in the candidate's employment history. Each object provides the start, end, and duration of the gap: { <-- gap start: // A Moment.js date end: // A Moment.js date duration: // Gap len...
run
javascript
hacksalot/HackMyResume
src/inspectors/gap-inspector.js
https://github.com/hacksalot/HackMyResume/blob/master/src/inspectors/gap-inspector.js
MIT
run( rez ) { // "Quote" or safely escape a keyword so it can be used as a regex. For // example, if the keyword is "C++", yield "C\+\+". // http://stackoverflow.com/a/2593661/4942583 const regex_quote = str => (str + '').replace(/[.?*+^$[\]\\(){}|-]/ig, '\\$&'); // Create a searchable plain-text d...
Run the Keyword Inspector on a resume. @method run @return An collection of statistical keyword data.
run
javascript
hacksalot/HackMyResume
src/inspectors/keyword-inspector.js
https://github.com/hacksalot/HackMyResume/blob/master/src/inspectors/keyword-inspector.js
MIT
run( rez ) { const sectionTotals = { }; _.each(rez, function(val, key) { if (_.isArray( val ) && !_.isString(val)) { return sectionTotals[ key ] = val.length; } else if (val.history && _.isArray( val.history )) { return sectionTotals[ key ] = val.history.length; } else if (val...
Run the Totals Inspector on a resume. @method run @return An object containing summary information for each section on the resume.
run
javascript
hacksalot/HackMyResume
src/inspectors/totals-inspector.js
https://github.com/hacksalot/HackMyResume/blob/master/src/inspectors/totals-inspector.js
MIT
generateSimple( data, tpl ) { let template; try { // Compile and run the Handlebars template. template = HANDLEBARS.compile(tpl, { strict: false, assumeObjects: false, noEscape: data.opts.noescape } ); return template(data); } catch (err) { throw{...
Perform template-based resume generation using Handlebars.js. @class HandlebarsGenerator
generateSimple
javascript
hacksalot/HackMyResume
src/renderers/handlebars-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/handlebars-generator.js
MIT
generate( json, jst, format, curFmt, opts, theme ) { // Preprocess text let encData = json; if ((format === 'html') || (format === 'pdf')) { encData = json.markdownify(); } if( format === 'doc' ) { encData = json.xmlify(); } // Set up partials and helpers registerPartials(f...
Perform template-based resume generation using Handlebars.js. @class HandlebarsGenerator
generate
javascript
hacksalot/HackMyResume
src/renderers/handlebars-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/handlebars-generator.js
MIT
registerPartials = function(format, theme) { if (_.contains( ['html','doc','md','txt','pdf'], format )) { // Locate the global partials folder const partialsFolder = PATH.join( parsePath( require.resolve('fresh-themes') ).dirname, '/partials/', format === 'pdf' ? 'html' : format ); ...
Perform template-based resume generation using Handlebars.js. @class HandlebarsGenerator
registerPartials
javascript
hacksalot/HackMyResume
src/renderers/handlebars-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/handlebars-generator.js
MIT
generate( json, jst, format, cssInfo, opts, theme ) { // Disable JRS theme chatter (console.log, console.error, etc.) const turnoff = ['log', 'error', 'dir']; const org = turnoff.map(function(c) { const ret = console[c]; // eslint-disable-line no-console console[c] = function() {}; // eslint-di...
Perform template-based resume generation for JSON Resume themes. @class JRSGenerator
generate
javascript
hacksalot/HackMyResume
src/renderers/jrs-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/jrs-generator.js
MIT
MDIN = txt => // TODO: Move this MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, '')
Perform template-based resume generation for JSON Resume themes. @class JRSGenerator
MDIN
javascript
hacksalot/HackMyResume
src/renderers/jrs-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/jrs-generator.js
MIT
generateSimple( data, tpl ) { let t; try { // Compile and run the Handlebars template. t = _.template(tpl); return t(data); } catch (err) { //console.dir _error const HMS = require('../core/status-codes'); throw{ fluenterror: HMS[t ? 'invokeTemplate' : 'compileTem...
Perform template-based resume generation using Underscore.js. @class UnderscoreGenerator
generateSimple
javascript
hacksalot/HackMyResume
src/renderers/underscore-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/underscore-generator.js
MIT
generate( json, jst, format, cssInfo, opts, theme ) { // Tweak underscore's default template delimeters let delims = (opts.themeObj && opts.themeObj.delimeters) || opts.template; if (opts.themeObj && opts.themeObj.delimeters) { delims = _.mapObject(delims, (val) => new RegExp(val, 'ig')); } _...
Perform template-based resume generation using Underscore.js. @class UnderscoreGenerator
generate
javascript
hacksalot/HackMyResume
src/renderers/underscore-generator.js
https://github.com/hacksalot/HackMyResume/blob/master/src/renderers/underscore-generator.js
MIT
scrubResume(rep, opts) { const traverse = require('traverse'); const ignoreList = []; const privateList = []; const includePrivates = opts && opts.private; const scrubbed = traverse( rep ).map(function() { // [^1] if (!this.isLeaf) { if ((this.node.ignore === true) || (this.node.ignor...
Removes ignored or private fields from a resume object @returns an object with the following structure: { scrubbed: the processed resume object ignoreList: an array of ignored nodes that were removed privateList: an array of private nodes that were removed }
scrubResume
javascript
hacksalot/HackMyResume
src/utils/resume-scrubber.js
https://github.com/hacksalot/HackMyResume/blob/master/src/utils/resume-scrubber.js
MIT
transformStringsInObject = function( obj, filters ) { if (!obj) { return; } if (moment.isMoment(obj)) { return; } if (_.isArray( obj )) { return obj.forEach(function(elem, idx, ar) { if ((typeof elem === 'string') || elem instanceof String) { return ar[idx] = transformer( null, elem...
Create a copy of this object in which all string fields have been run through a transformation function (such as a Markdown filter or XML encoder).
transformStringsInObject
javascript
hacksalot/HackMyResume
src/utils/string-transformer.js
https://github.com/hacksalot/HackMyResume/blob/master/src/utils/string-transformer.js
MIT
constructor( ex, rawData ) { let JSONLint = require('json-lint'); const lint = JSONLint(rawData, { comments: false }); if (lint.error) { [this.line, this.col] = Array.from([lint.line, lint.character]); } if (!lint.error) { JSONLint = require('jsonlint'); try { JSONLint.parse(rawData)...
Represents a SyntaxError exception with line and column info. Collect syntax error information from the provided exception object. The JavaScript `SyntaxError` exception isn't interpreted uniformly across environ- ments, so we reparse on error to grab the line and column. See: http://stackoverflow.com/q/13323356 @class...
constructor
javascript
hacksalot/HackMyResume
src/utils/syntax-error-ex.js
https://github.com/hacksalot/HackMyResume/blob/master/src/utils/syntax-error-ex.js
MIT
_analyze = function( sources, dst, opts ) { if (!sources || !sources.length) { this.err(HMSTATUS.resumeNotFound, { quit: true }); return null; } const nlzrs = _loadInspectors(); const results = _.map(sources, function(src) { const r = ResumeFactory.loadOne(src, { format: 'FRESH', objectify: true, ...
Private workhorse for the 'analyze' command.
_analyze
javascript
hacksalot/HackMyResume
src/verbs/analyze.js
https://github.com/hacksalot/HackMyResume/blob/master/src/verbs/analyze.js
MIT
_build = function( src, dst, opts ) { let err; if (!src || !src.length) { this.err(HMSTATUS.resumeNotFound, {quit: true}); return null; } _prep.call(this, src, dst, opts); // Load input resumes as JSON... const sheetObjects = ResumeFactory.load(src, { format: null, objectify: false, quit: tru...
Given a source resume in FRESH or JRS format, a destination resume path, and a theme file, generate 0..N resumes in the desired formats. @param src Path to the source JSON resume file: "rez/resume.json". @param dst An array of paths to the target resume file(s). @param opts Generation options.
_build
javascript
hacksalot/HackMyResume
src/verbs/build.js
https://github.com/hacksalot/HackMyResume/blob/master/src/verbs/build.js
MIT
_single = function( targInfo, theme, finished ) { let ret = null; let ex = null; const f = targInfo.file; try { if (!targInfo.fmt) { return { }; } let theFormat = null; this.stat(HMEVENT.beforeGenerate, { fmt: targInfo.fmt.outFormat, file: PATH.relative(process.cwd(), f) ...
Generate a single target resume such as "out/rez.html" or "out/rez.doc". TODO: Refactor. @param targInfo Information for the target resume. @param theme A FRESHTheme or JRSTheme object.
_single
javascript
hacksalot/HackMyResume
src/verbs/build.js
https://github.com/hacksalot/HackMyResume/blob/master/src/verbs/build.js
MIT
_verifyOutputs = function( targets, theme ) { this.stat(HMEVENT.verifyOutputs, {targets, theme}); return _.reject(targets.map( function( t ) { const pathInfo = parsePath(t); return {format: pathInfo.extname.substr(1)}; }), t => (t.format === 'all') || theme.hasFormat( t.format )); }
Ensure that user-specified outputs/targets are valid.
_verifyOutputs
javascript
hacksalot/HackMyResume
src/verbs/build.js
https://github.com/hacksalot/HackMyResume/blob/master/src/verbs/build.js
MIT
_addFreebieFormats = function( theTheme ) { // Add freebie formats (JSON, YAML, PNG) every theme gets... // Add HTML-driven PNG only if the theme has an HTML format. theTheme.formats.json = theTheme.formats.json || { freebie: true, title: 'json', outFormat: 'json', pre: 'json', ext: 'json', path: null, da...
Reinforce the chosen theme with "freebie" formats provided by HackMyResume. A "freebie" format is an output format such as JSON, YML, or PNG that can be generated directly from the resume model or from one of the theme's declared output formats. For example, the PNG format can be generated for any theme that declares a...
_addFreebieFormats
javascript
hacksalot/HackMyResume
src/verbs/build.js
https://github.com/hacksalot/HackMyResume/blob/master/src/verbs/build.js
MIT