diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-04-30 23:07:43 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-04-30 23:07:43 +0200 |
commit | c681cd286a746d5cf3f69fc800bcb79a42e70973 (patch) | |
tree | 66b852e90ebfe38da444532af729f7a5af0c6e5d /lib/utils/command.js | |
parent | c1d53ec11fbe085932df911bda5686b7bf671f53 (diff) | |
download | gitbook-c681cd286a746d5cf3f69fc800bcb79a42e70973.zip gitbook-c681cd286a746d5cf3f69fc800bcb79a42e70973.tar.gz gitbook-c681cd286a746d5cf3f69fc800bcb79a42e70973.tar.bz2 |
Remove lodash dependency
Diffstat (limited to 'lib/utils/command.js')
-rw-r--r-- | lib/utils/command.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/utils/command.js b/lib/utils/command.js index 93df750..083e72e 100644 --- a/lib/utils/command.js +++ b/lib/utils/command.js @@ -1,4 +1,3 @@ -var _ = require('lodash'); var childProcess = require('child_process'); var spawn = require('spawn-cmd').spawn; var Promise = require('./promise'); @@ -62,15 +61,22 @@ function escapeShellArg(s) { } function optionsToShellArgs(options) { - return _.chain(options) - .map(function(value, key) { - if (value === null || value === undefined || value === false) return null; - if (value === true) return key; - return key + '=' + escapeShellArg(value); - }) - .compact() - .value() - .join(' '); + var result = []; + + for (var key in options) { + var value = options[key]; + + if (value === null || value === undefined || value === false) { + continue; + } + if (value === true) { + result.push(key); + } + + result.push(key + '=' + escapeShellArg(value)); + } + + return result.join(' '); } module.exports = { |