yargs-unparser
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -37,3 +37,3 @@ 'use strict'; | ||
} else if (Array.isArray(value)) { | ||
unparsed.push(keyToFlag(key), ...value.map((item) => `${item}`)); | ||
value.forEach((item) => unparseOption(key, item, unparsed)); | ||
} else if (isPlainObject(value)) { | ||
@@ -40,0 +40,0 @@ const flattened = flatten(value, { safe: true }); |
{ | ||
"name": "yargs-unparser", | ||
"description": "Converts back a yargs argv object to its original array form.", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"keywords": [ | ||
@@ -19,19 +19,38 @@ "yargs", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"files": [], | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:staged": "lint-staged", | ||
"test": "jest --env node --coverage", | ||
"test:watch": "jest --env node --watch", | ||
"posttest": "npm run lint", | ||
"precommit": "npm run lint:staged" | ||
"prerelease": "npm t && npm run lint", | ||
"release": "standard-version", | ||
"precommit": "lint-staged", | ||
"commitmsg": "commitlint -e $GIT_PARAMS" | ||
}, | ||
"standard-version": { | ||
"scripts": { | ||
"posttag": "git push --follow-tags origin master && npm publish" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": "eslint" | ||
"*.js": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^5.2.4", | ||
"@commitlint/config-conventional": "^5.2.3", | ||
"eslint": "^4.3.0", | ||
"eslint-config-moxy": "^3.0.0", | ||
"eslint-config-moxy": "^4.1.0", | ||
"husky": "^0.14.3", | ||
"jest": "^21.0.1", | ||
"lint-staged": "^4.0.2", | ||
"jest": "^22.0.0", | ||
"lint-staged": "^6.0.0", | ||
"minimist": "^1.2.0", | ||
"standard-version": "^4.2.0", | ||
"yargs-parser": "^8.0.0" | ||
@@ -38,0 +57,0 @@ }, |
@@ -26,3 +26,3 @@ # yargs-unparser | ||
`$ npm install yargs-unparser --save` | ||
`$ npm install yargs-unparser` | ||
@@ -50,3 +50,3 @@ | ||
- `alias`: The [aliases](https://github.com/yargs/yargs-parser#requireyargs-parserargs-opts) so that duplicate options aren't generated | ||
- `default`: The [default] values so that they flags with their default values are omitted | ||
- `default`: The [default](https://github.com/yargs/yargs-parser#requireyargs-parserargs-opts) values so that they flags with their default values are omitted | ||
- `command`: The [command](https://github.com/yargs/yargs/blob/master/docs/advanced.md#commands) first argument so that command names and positional arguments are handled correctly | ||
@@ -76,11 +76,13 @@ | ||
**NOTE**: The returned array can be parsed again by `yargs-parser` using the default configuration. If you used custom configuration that you want `yargs-unparser` to be aware, please fill an [issue](https://github.com/moxystudio/yargs-unparser/issues). | ||
### Caveats | ||
**NOTE**: If you `coerce` in weird ways, things might not work correctly. | ||
The returned array can be parsed again by `yargs-parser` using the default configuration. If you used custom configuration that you want `yargs-unparser` to be aware, please fill an [issue](https://github.com/moxystudio/yargs-unparser/issues). | ||
If you `coerce` in weird ways, things might not work correctly. | ||
## Tests | ||
`$ npm test` | ||
`$ npm test:watch` during development | ||
`$ npm test -- --watch` during development | ||
@@ -87,0 +89,0 @@ |
10831
5
90
10