diff --git a/index.js b/index.js index 5b092c9e..084a2ffd 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -var assign = require('lodash.assign') var camelCase = require('camelcase') var path = require('path') var tokenizeArgString = require('./lib/tokenize-arg-string') @@ -11,7 +10,7 @@ function parse (args, opts) { args = tokenizeArgString(args) // aliases might have transitive relationships, normalize this. var aliases = combineAliases(opts.alias || {}) - var configuration = assign({}, { + var configuration = assign({ 'short-option-groups': true, 'camel-case-expansion': true, 'dot-notation': true, @@ -692,6 +691,20 @@ function combineAliases (aliases) { return combined } +function assign (defaults, configuration) { + var o = {} + configuration = configuration || {} + + Object.keys(configuration).forEach(function (k) { + o[k] = configuration[k] + }) + Object.keys(defaults).forEach(function (k) { + if (o[k] === undefined) o[k] = defaults[k] + }) + + return o +} + // this function should only be called when a count is given as an arg // it is NOT called to set a default value // thus we can start the count at 1 instead of 0 diff --git a/package.json b/package.json index ddf37a98..9d152b47 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "standard-version": "^2.1.2" }, "dependencies": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.1.0" + "camelcase": "^3.0.0" }, "files": [ "lib",