[Pkg-javascript-commits] [node-dargs] 07/54: Use equal sign instead of space between option key and value

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:01 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 ceb10d3ca373fd661be007d575984618443cd967
Author: Radko Dinev <radko.dinev at gmail.com>
Date:   Wed Aug 20 12:52:29 2014 +0300

    Use equal sign instead of space between option key and value
---
 index.js  |  6 +++---
 readme.md |  8 ++++----
 test.js   | 12 ++++++------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/index.js b/index.js
index b937327..b736886 100644
--- a/index.js
+++ b/index.js
@@ -17,16 +17,16 @@ module.exports = function (options, excludes) {
 		}
 
 		if (typeof val === 'string') {
-			args.push('--' + flag, val);
+			args.push('--' + flag + '=' + val);
 		}
 
 		if (typeof val === 'number' && isNaN(val) === false) {
-			args.push('--' + flag, '' + val);
+			args.push('--' + flag + '=' + ('' + val));
 		}
 
 		if (Array.isArray(val)) {
 			val.forEach(function (arrVal) {
-				args.push('--' + flag, arrVal);
+				args.push('--' + flag + '=' + arrVal);
 			});
 		}
 	});
diff --git a/readme.md b/readme.md
index 993035a..f2bdba4 100644
--- a/readme.md
+++ b/readme.md
@@ -32,11 +32,11 @@ console.log(dargs(options, excludes));
 
 /*
 [
-	'--foo', 'bar',
+	'--foo=bar',
 	'--hello',
-	'--camel-case', '5',
-	'--multiple', 'value',
-	'--multiple', 'value2'
+	'--camel-case=5',
+	'--multiple=value',
+	'--multiple=value2'
 ]
 */
 ```
diff --git a/test.js b/test.js
index 00d33c3..3c48d04 100644
--- a/test.js
+++ b/test.js
@@ -17,11 +17,11 @@ describe('dargs()', function () {
 	it('convert options to cli flags', function () {
 		var actual = dargs(fixture);
 		var expected = [
-			'--a', 'foo',
+			'--a=foo',
 			'--b',
-			'--d', '5',
-			'--e', 'foo',
-			'--e', 'bar',
+			'--d=5',
+			'--e=foo',
+			'--e=bar',
 			'--camel-case-camel'
 		];
 		assert.deepEqual(actual, expected);
@@ -30,8 +30,8 @@ describe('dargs()', function () {
 	it('exclude options', function () {
 		var actual = dargs(fixture, ['b', 'e']);
 		var expected = [
-			'--a', 'foo',
-			'--d', '5',
+			'--a=foo',
+			'--d=5',
 			'--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