1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-12-23 05:37:23 +00:00

Remove custom "extend" method.

Replace with NPM extend.
This commit is contained in:
hacksalot 2016-01-18 17:31:08 -05:00
parent c98d05270e
commit e72564162b
9 changed files with 14 additions and 96 deletions

View File

@ -51,6 +51,7 @@
"chalk": "^1.1.1",
"commander": "^2.9.0",
"copy": "^0.1.3",
"extend": "^3.0.0",
"fresca": "~0.4.0",
"fresh-jrs-converter": "^0.2.0",
"fresh-resume-starter": "^0.2.0",

View File

@ -13,7 +13,7 @@ Definition of the `main` function.
var HMR = require( '../hackmyapi')
, PKG = require('../../package.json')
, FS = require('fs')
, EXTEND = require('../utils/extend')
, EXTEND = require('extend')
, chalk = require('chalk')
, PATH = require('path')
, HACKMYSTATUS = require('../core/status-codes')

View File

@ -18,7 +18,7 @@ Output routines for HackMyResume.
, PATH = require('path')
, LO = require('lodash')
, FS = require('fs')
, EXTEND = require('../utils/extend')
, EXTEND = require('extend')
, HANDLEBARS = require('handlebars')
, YAML = require('yamljs')
, printf = require('printf')

View File

@ -11,7 +11,7 @@ Definition of the FRESHResume class.
var FS = require('fs')
, extend = require('../utils/extend')
, extend = require('extend')
, validator = require('is-my-json-valid')
, _ = require('underscore')
, __ = require('lodash')

View File

@ -9,13 +9,12 @@ Definition of the FRESHTheme class.
var FS = require('fs')
, extend = require('../utils/extend')
, validator = require('is-my-json-valid')
, _ = require('underscore')
, PATH = require('path')
, parsePath = require('parse-filepath')
, pathExists = require('path-exists').sync
, EXTEND = require('../utils/extend')
, EXTEND = require('extend')
, moment = require('moment')
, READFILES = require('recursive-readdir-sync');

View File

@ -11,7 +11,7 @@ Definition of the JRSResume class.
var FS = require('fs')
, extend = require('../utils/extend')
, extend = require('extend')
, validator = require('is-my-json-valid')
, _ = require('underscore')
, PATH = require('path')

View File

@ -16,7 +16,7 @@ Definition of the TemplateGenerator class. TODO: Refactor
, parsePath = require('parse-filepath')
, MKDIRP = require('mkdirp')
, BaseGenerator = require( './base-generator' )
, EXTEND = require('../utils/extend')
, EXTEND = require('extend')
, FRESHTheme = require('../core/fresh-theme')
, JRSTheme = require('../core/jrs-theme');

View File

@ -1,79 +0,0 @@
/**
Definition of the `extend` method.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module extend.js
*/
function _extend() {
function isPlainObject( obj ) {
if ((typeof obj !== "object") || obj.nodeType ||
(obj !== null && obj === obj.window)) {
return false;
}
if (obj.constructor &&
!hasOwnProperty.call( obj.constructor.prototype, "isPrototypeOf" )) {
return false;
}
return true;
}
var options
, name
, src
, copy
, copyIsArray
, clone
, target = arguments[0] || {}
, i = 1
, length = arguments.length
, deep = false;
// Handle a deep copy situation
if (typeof target === "boolean") {
deep = target;
// Skip the boolean and the target
target = arguments[i] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
//if (typeof target !== "object" && !jQuery.isFunction(target))
if (typeof target !== "object" && typeof target !== "function")
target = {};
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) !== null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) continue;
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) ||
(copyIsArray = (copy.constructor === Array)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && (src.constructor === Array) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = _extend(deep, clone, copy);
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
}
module.exports = _extend;

View File

@ -10,26 +10,23 @@ Implementation of the 'build' verb for HackMyResume.
var PATH = require('path')
var _ = require('underscore')
, PATH = require('path')
, FS = require('fs')
, MD = require('marked')
, MKDIRP = require('mkdirp')
, EXTEND = require('../utils/extend')
, extend = require('extend')
, parsePath = require('parse-filepath')
, RConverter = require('fresh-jrs-converter')
, HMSTATUS = require('../core/status-codes')
, HMEVENT = require('../core/event-codes')
, RConverter = require('fresh-jrs-converter')
, RTYPES = { FRESH: require('../core/fresh-resume'),
JRS: require('../core/jrs-resume') }
, parsePath = require('parse-filepath')
, _opts = require('../core/default-options')
, FluentTheme = require('../core/fresh-theme')
, FRESHTheme = require('../core/fresh-theme')
, JRSTheme = require('../core/jrs-theme')
, ResumeFactory = require('../core/resume-factory')
, _ = require('underscore')
, _fmts = require('../core/default-formats')
, extend = require('../utils/extend')
, chalk = require('chalk')
, pad = require('string-padding')
, Verb = require('../verbs/verb');
var _err, _log, _rezObj;
@ -346,7 +343,7 @@ Implementation of the 'build' verb for HackMyResume.
// Create a FRESH or JRS theme object
var theTheme = _opts.theme.indexOf('jsonresume-theme-') > -1 ?
new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );
new JRSTheme().open(tFolder) : new FRESHTheme().open( tFolder );
// Cache the theme object
_opts.themeObj = theTheme;