diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-12 11:34:44 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-12 11:34:44 -1000 |
commit | 0d1706f6788075c581198d8ef130c5035aa7eab2 (patch) | |
tree | f7b9331a698f0cfc49803545a29475f6eb113ffa /lib/util.js | |
parent | 9744455da720324fcef0a9c6c55b94df0e62ec41 (diff) | |
download | patchfoo-0d1706f6788075c581198d8ef130c5035aa7eab2.tar.gz patchfoo-0d1706f6788075c581198d8ef130c5035aa7eab2.zip |
Move mergeOpts into util
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js index e4cf415..57183d2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -186,3 +186,15 @@ u.pullSlice = function (start, end) { } } } + +u.mergeOpts = function (a, b) { + var obj = {}, k + for (k in a) { + obj[k] = a[k] + } + for (k in b) { + if (b[k] != null) obj[k] = b[k] + else delete obj[k] + } + return obj +} |