Comparing version 0.0.16 to 0.0.18
@@ -10,5 +10,6 @@ /** | ||
MongoId: require('./mongoid.js').MongoId, | ||
phpdate: require('./lib/phpdate'), | ||
str_repeat: require('./lib/str_repeat'), | ||
timeit: require('./lib/timeit'), | ||
phpdate: require('./lib/phpdate.js'), | ||
str_repeat: require('./lib/str_repeat.js'), | ||
timeit: require('./lib/timeit.js'), | ||
http_build_query: require('./lib/http_build_query.js'), | ||
@@ -15,0 +16,0 @@ /*** |
@@ -96,3 +96,4 @@ /** | ||
if (name[0] === '-') name = name.slice(1); | ||
found[name] = value; | ||
// leave single yes/no option boolean, convert repeated yes/no option into count | ||
found[name] = (value === true ? (found[name] ? found[name] + 1 : true) : value); | ||
} | ||
@@ -99,0 +100,0 @@ |
@@ -1,2 +0,1 @@ | ||
module.exports.mongoid = require('./lib/mongoid').mongoid; | ||
module.exports.MongoId = require('./lib/mongoid').MongoId; | ||
module.exports = require('./lib/mongoid.js'); |
{ | ||
"name": "arlib", | ||
"version": "0.0.16", | ||
"version": "0.0.18", | ||
"description": "Andras' Utility Functions", | ||
@@ -42,3 +42,4 @@ "license": "Apache-2.0", | ||
"php", | ||
"timeit" | ||
"timeit", | ||
"http_build_query" | ||
], | ||
@@ -45,0 +46,0 @@ "dependencies": { |
@@ -54,2 +54,16 @@ /** | ||
}, | ||
'should return boolean for yes/no option': function(t) { | ||
var opts = getopt("nodejs script.js -h", "h"); | ||
t.equal(opts.h, true); | ||
t.equal(typeof opts.h, 'boolean'); | ||
t.done(); | ||
}, | ||
'should return count for repeated yes/no option': function(t) { | ||
var opts = getopt("nodejs script.js -h -h", "h"); | ||
t.equal(opts.h, 2); | ||
t.equal(typeof opts.h, 'number'); | ||
t.done(); | ||
}, | ||
}; |
55643
30
1283