Skip to content

Commit 5402b06

Browse files
committed
Improve prototype resolution
1 parent ce68d3a commit 5402b06

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

primitive/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ var clear = require('es5-ext/object/clear')
2020
module.exports = PrimitiveMap = function (/*iterable, serialize*/) {
2121
var iterable = arguments[0], serialize = arguments[1], self;
2222
if (!(this instanceof PrimitiveMap)) throw new TypeError('Constructor requires \'new\'');
23-
if (isNative && setPrototypeOf) self = setPrototypeOf(new Map(), getPrototypeOf(this));
24-
else self = this;
23+
if (isNative && setPrototypeOf && (Map !== MapPolyfill)) {
24+
self = setPrototypeOf(new Map(), getPrototypeOf(this));
25+
} else {
26+
self = this;
27+
}
2528
if (iterable != null) iterator(iterable);
2629
if (serialize !== undefined) {
2730
callable(serialize);

0 commit comments

Comments
 (0)