mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 00:10:15 +00:00
parseJSON has been modified to always include private fields if not otherwise instructed. This is to ensure back-compatibility. The BUILD command instead, excludes private fields by default
This commit is contained in:
parent
fed59b704e
commit
664eea752f
0
dist/cli/index.js
vendored
Normal file → Executable file
0
dist/cli/index.js
vendored
Normal file → Executable file
35
dist/core/abstract-resume.js
vendored
35
dist/core/abstract-resume.js
vendored
@ -62,6 +62,41 @@ Definition of the AbstractResume class.
|
|||||||
return lastDate.diff(firstDate, unit);
|
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;
|
return AbstractResume;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
19
dist/core/fresh-resume.js
vendored
19
dist/core/fresh-resume.js
vendored
@ -77,24 +77,11 @@ Definition of the FRESHResume class.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
FreshResume.prototype.parseJSON = function(rep, opts) {
|
FreshResume.prototype.parseJSON = function(rep, opts) {
|
||||||
var ignoreList, privateList, ref, scrubbed, that, traverse;
|
var ignoreList, privateList, ref, ref1, scrubbed, that;
|
||||||
that = this;
|
that = this;
|
||||||
traverse = require('traverse');
|
ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
|
||||||
ignoreList = [];
|
|
||||||
privateList = [];
|
|
||||||
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') && !(opts != null ? opts["private"] : void 0)) {
|
|
||||||
privateList.push(this.node);
|
|
||||||
return this.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
extend(true, this, scrubbed);
|
extend(true, this, scrubbed);
|
||||||
if (!((ref = this.imp) != null ? ref.processed : void 0)) {
|
if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
if (opts.imp === void 0 || opts.imp) {
|
if (opts.imp === void 0 || opts.imp) {
|
||||||
this.imp = this.imp || {};
|
this.imp = this.imp || {};
|
||||||
|
19
dist/core/jrs-resume.js
vendored
19
dist/core/jrs-resume.js
vendored
@ -71,25 +71,12 @@ Definition of the JRSResume class.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
JRSResume.prototype.parseJSON = function(rep, opts) {
|
JRSResume.prototype.parseJSON = function(rep, opts) {
|
||||||
var ignoreList, privateList, ref, scrubbed, that, traverse;
|
var ignoreList, privateList, ref, ref1, scrubbed, that;
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
that = this;
|
that = this;
|
||||||
traverse = require('traverse');
|
ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
|
||||||
ignoreList = [];
|
|
||||||
privateList = [];
|
|
||||||
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') && !(opts != null ? opts["private"] : void 0)) {
|
|
||||||
privateList.push(this.node);
|
|
||||||
return this.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
extend(true, this, scrubbed);
|
extend(true, this, scrubbed);
|
||||||
if (!((ref = this.imp) != null ? ref.processed : void 0)) {
|
if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
if (opts.imp === void 0 || opts.imp) {
|
if (opts.imp === void 0 || opts.imp) {
|
||||||
this.imp = this.imp || {};
|
this.imp = this.imp || {};
|
||||||
|
@ -50,4 +50,32 @@ class AbstractResume
|
|||||||
lastDate = _.last( new_e )[1];
|
lastDate = _.last( new_e )[1];
|
||||||
lastDate.diff firstDate, unit
|
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
|
||||||
|
}
|
||||||
|
###
|
||||||
|
scrubResume: (rep, opts) ->
|
||||||
|
traverse = require 'traverse'
|
||||||
|
ignoreList = []
|
||||||
|
privateList = []
|
||||||
|
includePrivates = if not opts?.private? then true else opts?.private
|
||||||
|
|
||||||
|
scrubbed = traverse( rep ).map ( x ) ->
|
||||||
|
if !@isLeaf
|
||||||
|
if @node.ignore == true || @node.ignore == 'true'
|
||||||
|
ignoreList.push @node
|
||||||
|
@remove()
|
||||||
|
else if (@node.private == true || @node.private == 'true') && !includePrivates
|
||||||
|
privateList.push @node
|
||||||
|
@remove()
|
||||||
|
|
||||||
|
scrubbed: scrubbed
|
||||||
|
ingoreList: ignoreList
|
||||||
|
privateList: privateList
|
||||||
|
|
||||||
module.exports = AbstractResume
|
module.exports = AbstractResume
|
||||||
|
@ -55,18 +55,7 @@ class FreshResume extends AbstractResume
|
|||||||
|
|
||||||
# Ignore any element with the 'ignore: true' or 'private: true' designator.
|
# Ignore any element with the 'ignore: true' or 'private: true' designator.
|
||||||
that = @
|
that = @
|
||||||
traverse = require 'traverse'
|
{ scrubbed, ignoreList, privateList } = @scrubResume rep, opts
|
||||||
ignoreList = []
|
|
||||||
privateList = []
|
|
||||||
|
|
||||||
scrubbed = traverse( rep ).map ( x ) ->
|
|
||||||
if !@isLeaf
|
|
||||||
if @node.ignore == true || @node.ignore == 'true'
|
|
||||||
ignoreList.push this.node
|
|
||||||
@remove()
|
|
||||||
else if (@node.private == true || @node.private == 'true') && !opts?.private
|
|
||||||
privateList.push @node
|
|
||||||
@remove()
|
|
||||||
|
|
||||||
# Now apply the resume representation onto this object
|
# Now apply the resume representation onto this object
|
||||||
extend( true, @, scrubbed );
|
extend( true, @, scrubbed );
|
||||||
|
@ -50,18 +50,7 @@ class JRSResume extends AbstractResume
|
|||||||
opts = opts || { };
|
opts = opts || { };
|
||||||
# Ignore any element with the 'ignore: true' or 'private: true' designator.
|
# Ignore any element with the 'ignore: true' or 'private: true' designator.
|
||||||
that = this
|
that = this
|
||||||
traverse = require 'traverse'
|
{ scrubbed, ignoreList, privateList } = @scrubResume rep, opts
|
||||||
ignoreList = []
|
|
||||||
privateList = []
|
|
||||||
|
|
||||||
scrubbed = traverse( rep ).map ( x ) ->
|
|
||||||
if !@isLeaf
|
|
||||||
if @node.ignore == true || @node.ignore == 'true'
|
|
||||||
ignoreList.push this.node
|
|
||||||
@remove()
|
|
||||||
else if (@node.private == true || @node.private == 'true') && !opts?.private
|
|
||||||
privateList.push @node
|
|
||||||
@remove()
|
|
||||||
|
|
||||||
# Extend resume properties onto ourself.
|
# Extend resume properties onto ourself.
|
||||||
extend true, this, scrubbed
|
extend true, this, scrubbed
|
||||||
|
@ -166,7 +166,6 @@ _build = ( src, dst, opts ) ->
|
|||||||
Prepare for a BUILD run.
|
Prepare for a BUILD run.
|
||||||
###
|
###
|
||||||
_prep = ( src, dst, opts ) ->
|
_prep = ( src, dst, opts ) ->
|
||||||
|
|
||||||
# Cherry-pick options //_opts = extend( true, _opts, opts );
|
# Cherry-pick options //_opts = extend( true, _opts, opts );
|
||||||
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
|
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
|
||||||
_opts.prettify = opts.prettify is true
|
_opts.prettify = opts.prettify is true
|
||||||
|
Loading…
Reference in New Issue
Block a user