1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-03 04:47:07 +01:00

Update JS.

Keep dist/ updated with src/ for the CLI and require() folks.
(package.json goes off dist).
This commit is contained in:
hacksalot
2016-02-15 16:38:01 -05:00
parent 214c53a3ab
commit a3ed56dd15
7 changed files with 54 additions and 29 deletions

View File

@ -62,6 +62,41 @@ Definition of the AbstractResume class.
return lastDate.diff(firstDate, unit);
};
/**
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
}
*/
AbstractResume.prototype.scrubResume = function(rep, opts) {
var ignoreList, includePrivates, privateList, scrubbed, traverse;
traverse = require('traverse');
ignoreList = [];
privateList = [];
includePrivates = (opts != null ? opts["private"] : void 0) == null ? true : opts != null ? opts["private"] : void 0;
scrubbed = traverse(rep).map(function(x) {
if (!this.isLeaf) {
if (this.node.ignore === true || this.node.ignore === 'true') {
ignoreList.push(this.node);
return this.remove();
} else if ((this.node["private"] === true || this.node["private"] === 'true') && !includePrivates) {
privateList.push(this.node);
return this.remove();
}
}
});
return {
scrubbed: scrubbed,
ingoreList: ignoreList,
privateList: privateList
};
};
return AbstractResume;
})();

View File

@ -77,20 +77,11 @@ Definition of the FRESHResume class.
*/
FreshResume.prototype.parseJSON = function(rep, opts) {
var ignoreList, ref, scrubbed, that, traverse;
var ignoreList, privateList, ref, ref1, scrubbed, that;
that = this;
traverse = require('traverse');
ignoreList = [];
scrubbed = traverse(rep).map(function(x) {
if (!this.isLeaf && this.node.ignore) {
if (this.node.ignore === true || this.node.ignore === 'true') {
ignoreList.push(this.node);
return this.remove();
}
}
});
ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
extend(true, this, scrubbed);
if (!((ref = this.imp) != null ? ref.processed : void 0)) {
if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
opts = opts || {};
if (opts.imp === void 0 || opts.imp) {
this.imp = this.imp || {};

View File

@ -71,21 +71,12 @@ Definition of the JRSResume class.
*/
JRSResume.prototype.parseJSON = function(rep, opts) {
var ignoreList, ref, scrubbed, that, traverse;
var ignoreList, privateList, ref, ref1, scrubbed, that;
opts = opts || {};
that = this;
traverse = require('traverse');
ignoreList = [];
scrubbed = traverse(rep).map(function(x) {
if (!this.isLeaf && this.node.ignore) {
if (this.node.ignore === true || this.node.ignore === 'true') {
ignoreList.push(this.node);
return this.remove();
}
}
});
ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
extend(true, this, scrubbed);
if (!((ref = this.imp) != null ? ref.processed : void 0)) {
if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
opts = opts || {};
if (opts.imp === void 0 || opts.imp) {
this.imp = this.imp || {};