diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-22 02:46:20 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-22 02:46:20 +0000 |
| commit | 5c5dc252311ddc47dbd6ea49f24bddeb9990f5fe (patch) | |
| tree | 472063fcd490f54883d2ea9d0e6aa7e4f8009707 /node_modules/mongodb/lib/utils.js | |
| parent | 0653dcc395a54c8c95ed4f997ff9bbf02ea60b5e (diff) | |
| parent | 21b3b50f84e7c4c4d30f2e5c73a444a0288e1c5d (diff) | |
Merge branch 'master' of https://github.com/HumairAK/solutions_repo
Diffstat (limited to 'node_modules/mongodb/lib/utils.js')
| -rw-r--r-- | node_modules/mongodb/lib/utils.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/mongodb/lib/utils.js b/node_modules/mongodb/lib/utils.js index 0b649b8..066269d 100644 --- a/node_modules/mongodb/lib/utils.js +++ b/node_modules/mongodb/lib/utils.js @@ -269,6 +269,31 @@ var filterOptions = function(options, names) { return filterOptions; } +// Object.assign method or polyfille +var assign = Object.assign ? Object.assign : function assign(target, firstSource) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert first argument to object'); + } + + var to = Object(target); + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) { + continue; + } + + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) { + to[nextKey] = nextSource[nextKey]; + } + } + } + return to; +} + exports.filterOptions = filterOptions; exports.mergeOptions = mergeOptions; exports.translateOptions = translateOptions; @@ -284,3 +309,4 @@ exports.decorateCommand = decorateCommand; exports.isObject = isObject; exports.debugOptions = debugOptions; exports.MAX_JS_INT = 0x20000000000000; +exports.assign = assign; |
