Comparing version 0.1.0 to 0.1.1
@@ -288,3 +288,3 @@ "use strict"; | ||
this.set(option, true); | ||
} else if (!optionPattern.test(arrayItems[0])) { | ||
} else if (arrayItems.length && !optionPattern.test(arrayItems[0])) { | ||
this.set(option, arrayItems.shift()); | ||
@@ -291,0 +291,0 @@ } |
{ | ||
"name": "nature", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Classify the things in your world and how they interact.", | ||
@@ -5,0 +5,0 @@ "main": "lib/nature.js", |
@@ -256,3 +256,33 @@ var assert = require("assert"), | ||
}); | ||
it("set(process.argv) should set correct defaults", function(){ | ||
process.argv = [ | ||
"/usr/local/bin/node", "/usr/local/bin/rename", "file1.test","file2.test", "file3.test", | ||
"file4.test", "file5.test", "--num", "--num2", "-f", "-m", "-d", "-r" | ||
]; | ||
_thing | ||
.define({ | ||
name: "files", | ||
type: Array, | ||
required: true, | ||
defaultOption: true, | ||
default: [] | ||
}) | ||
.define({ name: "find", type: "string", alias: "f" }) | ||
.define({ name: "make", type: "string", alias: "m", default: "pie" }) | ||
.define({ name: "num", type: "number" }) | ||
.define({ name: "num2", type: "number", default: 10 }) | ||
.define({ name: "replace", type: "string", alias: "r", default: "" }) | ||
.define({ name: "dry-run", type: "boolean", alias: "d" }) | ||
.set(process.argv); | ||
assert.strictEqual(_thing.find, undefined, JSON.stringify(_thing.toJSON())); | ||
assert.strictEqual(_thing.make, "pie", JSON.stringify(_thing.toJSON())); | ||
assert.strictEqual(_thing.replace, "", JSON.stringify(_thing.toJSON())); | ||
assert.strictEqual(_thing.num, undefined, JSON.stringify(_thing.toJSON())); | ||
assert.strictEqual(_thing.num2, 10, JSON.stringify(_thing.toJSON())); | ||
assert.strictEqual(_thing["dry-run"], true, JSON.stringify(_thing.toJSON())); | ||
assert.deepEqual(_thing.files, ["file1.test", "file2.test", "file3.test", "file4.test", "file5.test"]); | ||
}); | ||
it("set(optionsArray) with a type Array", function(){ | ||
@@ -259,0 +289,0 @@ _thing.define({ name:"one", type: Array }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74310
1560