[Pkg-javascript-commits] [node-dargs] 20/54: cleanup
Bastien Roucariès
rouca at moszumanska.debian.org
Wed Sep 6 09:41:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-dargs.
commit 808804072973459dd26d4e5f42514989e5c91042
Author: Sindre Sorhus <sindresorhus at gmail.com>
Date: Wed Oct 29 12:49:25 2014 +0700
cleanup
---
readme.md | 32 +++++++++++++++-----------------
test.js | 42 +++++++++++++++++++++---------------------
2 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/readme.md b/readme.md
index 34ea222..37edd98 100644
--- a/readme.md
+++ b/readme.md
@@ -30,36 +30,33 @@ var excludes = ['sad'];
var includes = ['camelCase', 'multiple', 'sad'];
console.log(dargs(options, excludes));
-
/*
[
- "--foo=bar",
- "--hello",
- "--camel-case=5",
- "--multiple=value",
- "--multiple=value2"
+ '--foo=bar',
+ '--hello',
+ '--camel-case=5',
+ '--multiple=value',
+ '--multiple=value2'
]
*/
console.log(dargs(options, excludes, includes));
-
/*
[
- "--camel-case=5",
- "--multiple=value",
- "--multiple=value2"
+ '--camel-case=5',
+ '--multiple=value',
+ '--multiple=value2'
]
*/
console.log(dargs(options, [], includes));
-
/*
[
- "--camel-case=5",
- "--multiple=value",
- "--multiple=value2",
- "--sad=:("
+ '--camel-case=5',
+ '--multiple=value',
+ '--multiple=value2',
+ '--sad=:(''
]
*/
```
@@ -78,13 +75,14 @@ Options to convert to command-line arguments.
Type: `array`
-Keys to exclude.
+Keys to exclude.
+Takes precedence over `includes`.
#### includes
Type: `array`
-Keys to include. (if a key is in both `excludes` and `includes`, it will be excluded)
+Keys to include.
## License
diff --git a/test.js b/test.js
index fd2dd08..9d91071 100644
--- a/test.js
+++ b/test.js
@@ -18,14 +18,14 @@ var fixture = {
it('convert options to cli flags', function () {
var actual = dargs(fixture);
var expected = [
- "--a=foo",
- "--b",
- "--d=5",
- "--e=foo",
- "--e=bar",
- "--h=with a space",
- "--i=let's try quotes",
- "--camel-case-camel"
+ '--a=foo',
+ '--b',
+ '--d=5',
+ '--e=foo',
+ '--e=bar',
+ '--h=with a space',
+ '--i=let\'s try quotes',
+ '--camel-case-camel'
];
assert.deepEqual(actual, expected);
});
@@ -33,31 +33,31 @@ it('convert options to cli flags', function () {
it('exclude options', function () {
var actual = dargs(fixture, ['b', 'e', 'h', 'i']);
var expected = [
- "--a=foo",
- "--d=5",
- "--camel-case-camel"
+ '--a=foo',
+ '--d=5',
+ '--camel-case-camel'
];
assert.deepEqual(actual, expected);
});
-it('includes options', function() {
+it('includes options', function () {
var actual = dargs(fixture, [], ['a', 'c', 'd', 'e', 'camelCaseCamel']);
var expected = [
- "--a=foo",
- "--d=5",
- "--e=foo",
- "--e=bar",
- "--camel-case-camel"
+ '--a=foo',
+ '--d=5',
+ '--e=foo',
+ '--e=bar',
+ '--camel-case-camel'
];
assert.deepEqual(actual, expected);
});
-it('excludes and includes options', function() {
+it('excludes and includes options', function () {
var actual = dargs(fixture, ['a', 'd'], ['a', 'c', 'd', 'e', 'camelCaseCamel']);
var expected = [
- "--e=foo",
- "--e=bar",
- "--camel-case-camel"
+ '--e=foo',
+ '--e=bar',
+ '--camel-case-camel'
];
assert.deepEqual(actual, expected);
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-dargs.git
More information about the Pkg-javascript-commits
mailing list