Comparing version 1.2.0 to 1.2.1
@@ -87,3 +87,28 @@ "use strict"; | ||
argv = argv.slice(titles.length); | ||
const res = Object.keys(config).reduce(({ | ||
const c = {}; | ||
const conf = { ...config | ||
}; | ||
if (titles.length) { | ||
const commands = Object.keys(conf).filter(key => { | ||
try { | ||
const { | ||
command | ||
} = conf[key]; | ||
return command; | ||
} catch (er) { | ||
return; | ||
} | ||
}); | ||
commands.forEach(key => { | ||
const { | ||
multiple | ||
} = conf[key]; | ||
const cc = multiple ? titles : titles[0]; | ||
c[key] = cc; | ||
delete conf[key]; | ||
}); | ||
} | ||
const res = Object.keys(conf).reduce(({ | ||
_argv, | ||
@@ -96,3 +121,3 @@ ...acc | ||
}; | ||
const val = config[key]; | ||
const val = conf[key]; | ||
let value; | ||
@@ -144,3 +169,4 @@ | ||
}, { | ||
_argv: argv | ||
_argv: argv, | ||
...c | ||
}); | ||
@@ -147,0 +173,0 @@ return res; |
@@ -0,1 +1,7 @@ | ||
## 25 June 2018 | ||
### 1.2.1 | ||
- [fix] Fix a bug when a single command was not detected. | ||
## 24 June 2018 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "argufy", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Parse command line arguments to Node.js CLI programs.", | ||
@@ -15,5 +15,8 @@ "main": "build", | ||
"e": "node example", | ||
"example/": "yarn e example/example.js", | ||
"build": "babel src --out-dir build --source-maps" | ||
"b": "b --source-maps", | ||
"example/": "yarn e example/example.js" | ||
}, | ||
"files": [ | ||
"build" | ||
], | ||
"repository": { | ||
@@ -33,8 +36,2 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/cli": "7.0.0-beta.51", | ||
"@babel/core": "7.0.0-beta.51", | ||
"@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.51", | ||
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.51", | ||
"@babel/register": "7.0.0-beta.51", | ||
"babel-plugin-transform-rename-import": "2.2.0", | ||
"documentary": "1.6.1", | ||
@@ -41,0 +38,0 @@ "yarn-s": "1.1.0", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
3
0
19684
7
176
1