3 function createArg(key, val) {
4 key = key.replace(/[A-Z]/g, '-$&').toLowerCase();
5 return '--' + key + (val ? '=' + val : '');
8 module.exports = function (opts, excludes, includes) {
11 Object.keys(opts).forEach(function (key) {
14 if (Array.isArray(excludes) && excludes.indexOf(key) !== -1) {
18 if (Array.isArray(includes) && includes.indexOf(key) === -1) {
23 args.push(createArg(key));
26 if (typeof val === 'string') {
27 args.push(createArg(key, val));
30 if (typeof val === 'number' && isNaN(val) === false) {
31 args.push(createArg(key, '' + val));
34 if (Array.isArray(val)) {
35 val.forEach(function (arrVal) {
36 args.push(createArg(key, arrVal));