mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-02 20:37:08 +01:00
chore: update project dependencies
This commit is contained in:
9
dist/inspectors/duration-inspector.js
vendored
9
dist/inspectors/duration-inspector.js
vendored
@ -8,7 +8,6 @@
|
||||
lo = require('lodash');
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
Compute the total duration of the work history.
|
||||
@returns The total duration of the sheet's work history, that is, the number
|
||||
@ -23,10 +22,16 @@
|
||||
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 each element in the array is a start date or an end date of a
|
||||
// job -- it doesn't matter which.
|
||||
new_e = hist.map(function(job) {
|
||||
var obj;
|
||||
obj = _.pick(job, [startKey, endKey]);
|
||||
if (!_.has(obj, endKey)) {
|
||||
// Synthesize an end date if this is a "current" gig
|
||||
obj[endKey] = 'current';
|
||||
}
|
||||
if (obj && (obj[startKey] || obj[endKey])) {
|
||||
@ -38,6 +43,7 @@
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
// Flatten the array, remove empties, and sort
|
||||
new_e = _.filter(_.flatten(new_e, true), function(v) {
|
||||
return v && v.length && v[0] && v[0].length;
|
||||
});
|
||||
@ -47,6 +53,7 @@
|
||||
new_e = _.sortBy(new_e, function(elem) {
|
||||
return elem[1].unix();
|
||||
});
|
||||
// END CODE DUPLICATION
|
||||
firstDate = _.first(new_e)[1];
|
||||
lastDate = _.last(new_e)[1];
|
||||
return lastDate.diff(firstDate, unit);
|
||||
|
42
dist/inspectors/gap-inspector.js
vendored
42
dist/inspectors/gap-inspector.js
vendored
@ -1,11 +1,12 @@
|
||||
|
||||
/**
|
||||
Employment gap analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/gap-inspector
|
||||
*/
|
||||
|
||||
(function() {
|
||||
/**
|
||||
Employment gap analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/gap-inspector
|
||||
*/
|
||||
/**
|
||||
Identify gaps in the candidate's employment history.
|
||||
*/
|
||||
var FluentDate, LO, _, gapInspector, moment;
|
||||
|
||||
_ = require('underscore');
|
||||
@ -16,14 +17,8 @@ Employment gap analysis for HackMyResume.
|
||||
|
||||
LO = require('lodash');
|
||||
|
||||
|
||||
/**
|
||||
Identify gaps in the candidate's employment history.
|
||||
*/
|
||||
|
||||
gapInspector = module.exports = {
|
||||
moniker: 'gap-inspector',
|
||||
|
||||
/**
|
||||
Run the Gap Analyzer on a resume.
|
||||
@method run
|
||||
@ -35,9 +30,10 @@ Employment gap analysis for HackMyResume.
|
||||
end: // A Moment.js date
|
||||
duration: // Gap length
|
||||
}
|
||||
*/
|
||||
*/
|
||||
run: function(rez) {
|
||||
var coverage, dur, g, gap_start, hist, new_e, num_gaps, o, ref_count, tdur, total_gap_days;
|
||||
// This is what we'll return
|
||||
coverage = {
|
||||
gaps: [],
|
||||
overlaps: [],
|
||||
@ -48,10 +44,14 @@ Employment gap analysis for HackMyResume.
|
||||
gaps: 0
|
||||
}
|
||||
};
|
||||
// Missing employment section? Bye bye.
|
||||
hist = LO.get(rez, 'employment.history');
|
||||
if (!hist || !hist.length) {
|
||||
return coverage;
|
||||
}
|
||||
// Convert the candidate's employment history to an array of dates,
|
||||
// where each element in the array is a start date or an end date of a
|
||||
// job -- it doesn't matter which.
|
||||
new_e = hist.map(function(job) {
|
||||
var obj;
|
||||
obj = _.pick(job, ['start', 'end']);
|
||||
@ -64,6 +64,7 @@ Employment gap analysis for HackMyResume.
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
// Flatten the array, remove empties, and sort
|
||||
new_e = _.filter(_.flatten(new_e, true), function(v) {
|
||||
return v && v.length && v[0] && v[0].length;
|
||||
});
|
||||
@ -73,6 +74,11 @@ Employment gap analysis for HackMyResume.
|
||||
new_e = _.sortBy(new_e, function(elem) {
|
||||
return elem[1].unix();
|
||||
});
|
||||
// Iterate over elements in the array. Each time a start date is found,
|
||||
// increment a reference count. Each time an end date is found, decrement
|
||||
// the reference count. When the reference count reaches 0, we have a gap.
|
||||
// When the reference count is > 0, the candidate is employed. When the
|
||||
// reference count reaches 2, the candidate is overlapped.
|
||||
num_gaps = 0;
|
||||
ref_count = 0;
|
||||
total_gap_days = 0;
|
||||
@ -81,11 +87,13 @@ Employment gap analysis for HackMyResume.
|
||||
var inc, lastGap, lastOver;
|
||||
inc = point[0] === 'start' ? 1 : -1;
|
||||
ref_count += inc;
|
||||
// If the ref count just reached 0, start a new GAP
|
||||
if (ref_count === 0) {
|
||||
return coverage.gaps.push({
|
||||
start: point[1],
|
||||
end: null
|
||||
});
|
||||
// If the ref count reached 1 by rising, end the last GAP
|
||||
} else if (ref_count === 1 && inc === 1) {
|
||||
lastGap = _.last(coverage.gaps);
|
||||
if (lastGap) {
|
||||
@ -93,11 +101,13 @@ Employment gap analysis for HackMyResume.
|
||||
lastGap.duration = lastGap.end.diff(lastGap.start, 'days');
|
||||
return total_gap_days += lastGap.duration;
|
||||
}
|
||||
// If the ref count reaches 2 by rising, start a new OVERLAP
|
||||
} else if (ref_count === 2 && inc === 1) {
|
||||
return coverage.overlaps.push({
|
||||
start: point[1],
|
||||
end: null
|
||||
});
|
||||
// If the ref count reaches 1 by falling, end the last OVERLAP
|
||||
} else if (ref_count === 1 && inc === -1) {
|
||||
lastOver = _.last(coverage.overlaps);
|
||||
if (lastOver) {
|
||||
@ -109,6 +119,9 @@ Employment gap analysis for HackMyResume.
|
||||
}
|
||||
}
|
||||
});
|
||||
// It's possible that the last gap/overlap didn't have an explicit .end
|
||||
// date.If so, set the end date to the present date and compute the
|
||||
// duration normally.
|
||||
if (coverage.overlaps.length) {
|
||||
o = _.last(coverage.overlaps);
|
||||
if (o && !o.end) {
|
||||
@ -123,6 +136,7 @@ Employment gap analysis for HackMyResume.
|
||||
g.duration = g.end.diff(g.start, 'days');
|
||||
}
|
||||
}
|
||||
// Package data for return to the client
|
||||
tdur = rez.duration('days');
|
||||
dur = {
|
||||
total: tdur,
|
||||
|
51
dist/inspectors/keyword-inspector.js
vendored
51
dist/inspectors/keyword-inspector.js
vendored
@ -1,48 +1,63 @@
|
||||
|
||||
/**
|
||||
Keyword analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/keyword-inspector
|
||||
*/
|
||||
|
||||
(function() {
|
||||
/**
|
||||
Keyword analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/keyword-inspector
|
||||
*/
|
||||
/**
|
||||
Analyze the resume's use of keywords.
|
||||
TODO: BUG: Keyword search regex is inaccurate, especially for one or two
|
||||
letter keywords like "C" or "CLI".
|
||||
@class keywordInspector
|
||||
*/
|
||||
var FluentDate, _, keywordInspector;
|
||||
|
||||
_ = require('underscore');
|
||||
|
||||
FluentDate = require('../core/fluent-date');
|
||||
|
||||
|
||||
/**
|
||||
Analyze the resume's use of keywords.
|
||||
TODO: BUG: Keyword search regex is inaccurate, especially for one or two
|
||||
letter keywords like "C" or "CLI".
|
||||
@class keywordInspector
|
||||
*/
|
||||
|
||||
keywordInspector = module.exports = {
|
||||
|
||||
/** A unique name for this inspector. */
|
||||
moniker: 'keyword-inspector',
|
||||
|
||||
/**
|
||||
Run the Keyword Inspector on a resume.
|
||||
@method run
|
||||
@return An collection of statistical keyword data.
|
||||
*/
|
||||
*/
|
||||
run: function(rez) {
|
||||
var prefix, regex_quote, searchable, suffix;
|
||||
// "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
|
||||
regex_quote = function(str) {
|
||||
return (str + '').replace(/[.?*+^$[\]\\(){}|-]/ig, "\\$&");
|
||||
};
|
||||
// Create a searchable plain-text digest of the resume
|
||||
// TODO: BUG: Don't search within keywords for other keywords. Job A
|
||||
// declares the "foo" keyword. Job B declares the "foo & bar" keyword. Job
|
||||
// B's mention of "foobar" should not count as a mention of "foo".
|
||||
// To achieve this, remove keywords from the search digest and treat them
|
||||
// separately.
|
||||
searchable = '';
|
||||
rez.transformStrings(['imp', 'computed', 'safe'], function(key, val) {
|
||||
return searchable += ' ' + val;
|
||||
});
|
||||
// Assemble a regex skeleton we can use to test for keywords with a bit
|
||||
// more
|
||||
prefix = '(?:' + ['^', '\\s+', '[\\.,]+'].join('|') + ')';
|
||||
suffix = '(?:' + ['$', '\\s+', '[\\.,]+'].join('|') + ')';
|
||||
return rez.keywords().map(function(kw) {
|
||||
var count, myArray, regex, regex_str;
|
||||
// 1. Using word boundary or other regex class is inaccurate
|
||||
|
||||
// var regex = new RegExp( '\\b' + regex_quote( kw )/* + '\\b'*/, 'ig');
|
||||
|
||||
// 2. Searching for the raw keyword is inaccurate ("C" will match any
|
||||
// word containing a 'c'!).
|
||||
|
||||
// var regex = new RegExp( regex_quote( kw ), 'ig');
|
||||
|
||||
// 3. Instead, use a custom regex with special delimeters.
|
||||
regex_str = prefix + regex_quote(kw) + suffix;
|
||||
regex = new RegExp(regex_str, 'ig');
|
||||
myArray = null;
|
||||
|
25
dist/inspectors/totals-inspector.js
vendored
25
dist/inspectors/totals-inspector.js
vendored
@ -1,32 +1,27 @@
|
||||
|
||||
/**
|
||||
Section analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/totals-inspector
|
||||
*/
|
||||
|
||||
(function() {
|
||||
/**
|
||||
Section analysis for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module inspectors/totals-inspector
|
||||
*/
|
||||
/**
|
||||
Retrieve sectional overview and summary information.
|
||||
@class totalsInspector
|
||||
*/
|
||||
var FluentDate, _, totalsInspector;
|
||||
|
||||
_ = require('underscore');
|
||||
|
||||
FluentDate = require('../core/fluent-date');
|
||||
|
||||
|
||||
/**
|
||||
Retrieve sectional overview and summary information.
|
||||
@class totalsInspector
|
||||
*/
|
||||
|
||||
totalsInspector = module.exports = {
|
||||
moniker: 'totals-inspector',
|
||||
|
||||
/**
|
||||
Run the Totals Inspector on a resume.
|
||||
@method run
|
||||
@return An object containing summary information for each section on the
|
||||
resume.
|
||||
*/
|
||||
*/
|
||||
run: function(rez) {
|
||||
var sectionTotals;
|
||||
sectionTotals = {};
|
||||
|
Reference in New Issue
Block a user