Skip to content

Commit

Permalink
fix(symbols): check that descriptors is an object
Browse files Browse the repository at this point in the history
In IE, createWithSymbols fails if descriptors is undefined, giving the following error:
"Object.getOwnPropertyNames: argument is not an Object"
This makes sure the item is an object before continuing.
  • Loading branch information
Ryan Heathcote committed Mar 10, 2017
1 parent 4a34b99 commit e181ff7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ if (typeof FEATURE_NO_ES2015 === 'undefined') {
},
createWithSymbols = function (proto, descriptors) {
var self = create(proto);
gOPN(descriptors).forEach(function (key) {
if (propertyIsEnumerable.call(descriptors, key)) {
$defineProperty(self, key, descriptors[key]);
}
});
if (descriptors !== null && typeof descriptors === 'object') {
gOPN(descriptors).forEach(function (key) {
if (propertyIsEnumerable.call(descriptors, key)) {
$defineProperty(self, key, descriptors[key]);
}
});
}
return self;
},
copyAsNonEnumerable = function (descriptor) {
Expand Down

0 comments on commit e181ff7

Please sign in to comment.