Comparing version 0.0.4 to 0.1.0
10
index.js
@@ -1,2 +0,3 @@ | ||
module.exports = function(args){ | ||
module.exports = function(args, opts){ | ||
opts = opts || {} | ||
args = args || ''; | ||
@@ -67,3 +68,10 @@ var arr = []; | ||
if(opts.removequotes){ | ||
arr = arr.map(function(arg){ | ||
if(arg.match(/\s/)) return arg | ||
return arg.replace(/^"|"$/g, ""); | ||
}); | ||
} | ||
return arr; | ||
} |
{ | ||
"name": "spawn-args", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "Turn a string of command line options into an array for child_process.spawn", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
spawn-args | ||
========== | ||
 | ||
 | ||
@@ -31,2 +31,3 @@ Turn a string of command line options into an array for child_process.spawn | ||
*/ | ||
``` | ||
@@ -33,0 +34,0 @@ ## license |
@@ -35,2 +35,15 @@ var parse = require('../'); | ||
}) | ||
it('should remove quotes if passed a config', function() { | ||
var string = '--host "hello.com" --fruit "apples oranges"' | ||
var keepquotes = parse(string) | ||
var removequotes = parse(string, { | ||
removequotes:true | ||
}) | ||
keepquotes[1].should.equal('"hello.com"') | ||
keepquotes[3].should.equal('"apples oranges"') | ||
removequotes[1].should.equal('hello.com') | ||
removequotes[3].should.equal('"apples oranges"') | ||
}) | ||
}) |
5196
104
35