From 5f2b3d93a5e4e21e48544be7b4098e38b3fdb2a6 Mon Sep 17 00:00:00 2001 From: eric thul Date: Sat, 5 Nov 2016 14:15:58 -0400 Subject: Adding dargs dependency See issue #69 --- src/dargs.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/dargs.js b/src/dargs.js index e5c574c..de049ba 100644 --- a/src/dargs.js +++ b/src/dargs.js @@ -1,16 +1,7 @@ 'use strict'; -function dargs(obj) { - return Object.keys(obj).reduce((args, key) => { - const arg = '--' + key.replace(/[A-Z]/g, '-$&').toLowerCase(); - const val = obj[key] +const dargs = require('dargs'); - if (key === '_') val.forEach(v => args.push(v)) - else if (Array.isArray(val)) val.forEach(v => args.push(arg, v)) - else args.push(arg, obj[key]) - - return args.filter(arg => (typeof arg !== 'boolean')) - }, []) -} - -module.exports = dargs; +module.exports = function(obj){ + return dargs(obj, {ignoreFalse: true}); +}; -- cgit v1.2.3