Skip to content

Commit 5e7eb11

Browse files
authored
fix: lodash.assign was deprecated (#59)
1 parent ec6df1c commit 5e7eb11

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

index.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var assign = require('lodash.assign')
21
var camelCase = require('camelcase')
32
var path = require('path')
43
var tokenizeArgString = require('./lib/tokenize-arg-string')
@@ -11,7 +10,7 @@ function parse (args, opts) {
1110
args = tokenizeArgString(args)
1211
// aliases might have transitive relationships, normalize this.
1312
var aliases = combineAliases(opts.alias || {})
14-
var configuration = assign({}, {
13+
var configuration = assign({
1514
'short-option-groups': true,
1615
'camel-case-expansion': true,
1716
'dot-notation': true,
@@ -692,6 +691,20 @@ function combineAliases (aliases) {
692691
return combined
693692
}
694693

694+
function assign (defaults, configuration) {
695+
var o = {}
696+
configuration = configuration || {}
697+
698+
Object.keys(configuration).forEach(function (k) {
699+
o[k] = configuration[k]
700+
})
701+
Object.keys(defaults).forEach(function (k) {
702+
if (o[k] === undefined) o[k] = defaults[k]
703+
})
704+
705+
return o
706+
}
707+
695708
// this function should only be called when a count is given as an arg
696709
// it is NOT called to set a default value
697710
// thus we can start the count at 1 instead of 0

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"standard-version": "^2.1.2"
3535
},
3636
"dependencies": {
37-
"camelcase": "^3.0.0",
38-
"lodash.assign": "^4.1.0"
37+
"camelcase": "^3.0.0"
3938
},
4039
"files": [
4140
"lib",

0 commit comments

Comments
 (0)