Skip to content

Commit

Permalink
Fix native prototype resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Apr 14, 2015
1 parent 45275c2 commit f454703
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions polyfill.js
Expand Up @@ -17,8 +17,11 @@ var setPrototypeOf = require('es5-ext/object/set-prototype-of')
module.exports = WeakMapPoly = function (/*iterable*/) {
var iterable = arguments[0], self;
if (!(this instanceof WeakMapPoly)) throw new TypeError('Constructor requires \'new\'');
if (isNative && setPrototypeOf) self = setPrototypeOf(new WeakMap(), getPrototypeOf(this));
else self = this;
if (isNative && setPrototypeOf && (WeakMap !== WeakMapPoly)) {
self = setPrototypeOf(new WeakMap(), getPrototypeOf(this));
} else {
self = this;
}
if (iterable != null) {
if (!isArray(iterable)) iterable = getIterator(iterable);
}
Expand Down

0 comments on commit f454703

Please sign in to comment.