Skip to content

Commit

Permalink
fix: lodash.assign was deprecated (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Sep 30, 2016
1 parent ec6df1c commit 5e7eb11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var assign = require('lodash.assign')
var camelCase = require('camelcase')
var path = require('path')
var tokenizeArgString = require('./lib/tokenize-arg-string')
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5e7eb11

Please sign in to comment.