string-argv
Advanced tools
Comparing version 0.1.1 to 0.1.2
13
index.js
@@ -30,3 +30,3 @@ "use strict"; | ||
// Index 0 is the matched text, which we use if no captured group exists | ||
myArray.push(match[1] || match[5] || match[0]); | ||
myArray.push(firstString(match[1], match[5], match[0])); | ||
} | ||
@@ -37,1 +37,12 @@ } while (match !== null); | ||
} | ||
// Accepts any number of arguments, and returns the first one that is a string | ||
// (even an empty string) | ||
function firstString() { | ||
for (var i = 0; i < arguments.length; i++) { | ||
var arg = arguments[i]; | ||
if (typeof arg === "string") { | ||
return arg; | ||
} | ||
} | ||
} |
{ | ||
"name": "string-argv", | ||
"description": "string-argv parses a string into an argument array to mimic process.argv. This is useful when testing Command Line Utilities that you want to pass arguments to.", | ||
"version": "0.1.1", | ||
"contributors": [{ | ||
"name": "Michael Ferris", | ||
"email": "mike.ferri@hotmail.com" | ||
}], | ||
"version": "0.1.2", | ||
"contributors": [ | ||
{ | ||
"name": "Michael Ferris", | ||
"email": "mike.ferri@hotmail.com" | ||
} | ||
], | ||
"author": { | ||
@@ -10,0 +12,0 @@ "name": "Anthony McCormick", |
@@ -0,0 +0,0 @@ |
5065
40