Skip to content

Commit 7ae720a

Browse files
authored
Object.assign for old versions
1 parent 412f565 commit 7ae720a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/resolve-value.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ var gatherVariableDependencies = require('./gather-variable-dependencies');
55
var findNodeAncestorWithSelector = require('./find-node-ancestor-with-selector');
66
var cloneSpliceParentOntoNodeWhen = require('./clone-splice-parent-onto-node-when');
77

8+
if (typeof Object.assign != 'function') {
9+
Object.assign = function(target, varArgs) { // .length of function is 2
10+
'use strict';
11+
if (target == null) { // TypeError if undefined or null
12+
throw new TypeError('Cannot convert undefined or null to object');
13+
}
14+
15+
var to = Object(target);
16+
17+
for (var index = 1; index < arguments.length; index++) {
18+
var nextSource = arguments[index];
19+
20+
if (nextSource != null) { // Skip over if undefined or null
21+
for (var nextKey in nextSource) {
22+
// Avoid bugs when hasOwnProperty is shadowed
23+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
24+
to[nextKey] = nextSource[nextKey];
25+
}
26+
}
27+
}
28+
}
29+
return to;
30+
};
31+
}
32+
833
// var() = var( <custom-property-name> [, <any-value> ]? )
934
// matches `name[, fallback]`, captures "name" and "fallback"
1035
// See: http://dev.w3.org/csswg/css-variables/#funcdef-var

0 commit comments

Comments
 (0)