summaryrefslogtreecommitdiffstats
path: root/node_modules/object.assign/implementation.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/object.assign/implementation.js')
-rw-r--r--node_modules/object.assign/implementation.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/node_modules/object.assign/implementation.js b/node_modules/object.assign/implementation.js
new file mode 100644
index 0000000..567efe9
--- /dev/null
+++ b/node_modules/object.assign/implementation.js
@@ -0,0 +1,42 @@
+'use strict';
+
+// modified from https://github.com/es-shims/es6-shim
+var keys = require('object-keys');
+var canBeObject = function (obj) {
+ return typeof obj !== 'undefined' && obj !== null;
+};
+var hasSymbols = require('has-symbols/shams')();
+var callBound = require('call-bind/callBound');
+var toObject = Object;
+var $push = callBound('Array.prototype.push');
+var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
+var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
+
+// eslint-disable-next-line no-unused-vars
+module.exports = function assign(target, source1) {
+ if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
+ var objTarget = toObject(target);
+ var s, source, i, props, syms, value, key;
+ for (s = 1; s < arguments.length; ++s) {
+ source = toObject(arguments[s]);
+ props = keys(source);
+ var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
+ if (getSymbols) {
+ syms = getSymbols(source);
+ for (i = 0; i < syms.length; ++i) {
+ key = syms[i];
+ if ($propIsEnumerable(source, key)) {
+ $push(props, key);
+ }
+ }
+ }
+ for (i = 0; i < props.length; ++i) {
+ key = props[i];
+ value = source[key];
+ if ($propIsEnumerable(source, key)) {
+ objTarget[key] = value;
+ }
+ }
+ }
+ return objTarget;
+};