Skip to content

Commit 5fbf325

Browse files
authored
Convert the options to camel case after getting them from minimist (#71)
1 parent f757a69 commit 5fbf325

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/utils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,16 @@ function dashToCamelCase(value) {
131131
* @return {Object} The object containg the key/value options
132132
*/
133133
function getBashOptions(args) {
134-
return minimist(args.slice(2));
134+
var options = minimist(args.slice(2));
135+
var settings = {};
136+
137+
Object.keys(options).forEach(function(optionName) {
138+
if (optionName !== '_') {
139+
settings[dashToCamelCase(optionName)] = options[optionName];
140+
}
141+
});
142+
143+
return settings;
135144
}
136145

137146
/**

test/utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ exports['utils'] = {
1515
let bashOptions = utils.getBashOptions([null, null, '--key=value', '--key2=value2']);
1616

1717
test.deepEqual(JSON.stringify(bashOptions), JSON.stringify({
18-
_: [],
1918
key: 'value',
2019
key2: 'value2'
2120
}), 'Given an array of node arguments.');

0 commit comments

Comments
 (0)