[Pkg-javascript-commits] [node-optimist] 09/33: Imported Upstream version 0.5.1

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Feb 27 23:21:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository node-optimist.

commit ffc96c01c823059964f62441035e7c272f26fc8c
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Feb 27 20:00:31 2015 +0100

    Imported Upstream version 0.5.1
---
 index.js               |  5 +++--
 package.json           |  2 +-
 test/parse_modified.js | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 7d44ad4..67e17d8 100644
--- a/index.js
+++ b/index.js
@@ -155,8 +155,9 @@ function Argv (args, cwd) {
         return self;
     };
     
-    self.parse = function (args) {
-        return Argv(args).argv;
+    self.parse = function (args_) {
+        args = args_;
+        return self.argv;
     };
     
     self.option = self.options = function (key, opt) {
diff --git a/package.json b/package.json
index ac0eeac..a5eb246 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
     "name" : "optimist",
-    "version" : "0.5.0",
+    "version" : "0.5.1",
     "description" : "Light-weight option parsing with an argv hash. No optstrings attached.",
     "main" : "./index.js",
     "dependencies" : {
diff --git a/test/parse_modified.js b/test/parse_modified.js
new file mode 100644
index 0000000..a57dc84
--- /dev/null
+++ b/test/parse_modified.js
@@ -0,0 +1,14 @@
+var optimist = require('../');
+var test = require('tap').test;
+
+test('parse with modifier functions' , function (t) {
+    t.plan(1);
+    
+    var argv = optimist().boolean('b').parse([ '-b', '123' ]);
+    t.deepEqual(fix(argv), { b: true, _: ['123'] });
+});
+
+function fix (obj) {
+    delete obj.$0;
+    return obj;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/node-optimist.git



More information about the Pkg-javascript-commits mailing list