1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-07-17 07:26:40 +01:00

chore: decaffeinate: convert error.coffee and 58 other files to JS

This commit is contained in:
decaffeinate
2018-02-13 20:43:42 -05:00
committed by hacksalot
parent b7cd01597e
commit 8a46d642e5
59 changed files with 4568 additions and 3676 deletions

View File

@@ -1,6 +1,11 @@
module.exports =
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
module.exports = {
###*
/**
Removes ignored or private fields from a resume object
@returns an object with the following structure:
{
@@ -8,40 +13,47 @@ module.exports =
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 = opts && opts.private
*/
scrubResume(rep, opts) {
const traverse = require('traverse');
const ignoreList = [];
const privateList = [];
const includePrivates = opts && opts.private;
scrubbed = traverse( rep ).map () -> # [^1]
if !@isLeaf
if @node.ignore == true || @node.ignore == 'true'
ignoreList.push @node
@delete()
else if (@node.private == true || @node.private == 'true') && !includePrivates
privateList.push @node
@delete()
if _.isArray(@node) # [^2]
@after () ->
@update _.compact this.node
return
return
const scrubbed = traverse( rep ).map(function() { // [^1]
if (!this.isLeaf) {
if ((this.node.ignore === true) || (this.node.ignore === 'true')) {
ignoreList.push(this.node);
this.delete();
} else if (((this.node.private === true) || (this.node.private === 'true')) && !includePrivates) {
privateList.push(this.node);
this.delete();
}
}
if (_.isArray(this.node)) { // [^2]
this.after(function() {
this.update(_.compact(this.node));
});
}
});
scrubbed: scrubbed
ingoreList: ignoreList
privateList: privateList
return {
scrubbed,
ingoreList: ignoreList,
privateList
};
}
};
# [^1]: As of v0.6.6, the NPM traverse library has a quirk when attempting
# to remove array elements directly using traverse's `this.remove`. See:
#
# https://github.com/substack/js-traverse/issues/48
#
# [^2]: The workaround is to use traverse's 'this.delete' to nullify the value
# first, followed by removal with something like _.compact.
#
# https://github.com/substack/js-traverse/issues/48#issuecomment-142607200
#
// [^1]: As of v0.6.6, the NPM traverse library has a quirk when attempting
// to remove array elements directly using traverse's `this.remove`. See:
//
// https://github.com/substack/js-traverse/issues/48
//
// [^2]: The workaround is to use traverse's 'this.delete' to nullify the value
// first, followed by removal with something like _.compact.
//
// https://github.com/substack/js-traverse/issues/48#issuecomment-142607200
//