Skip to content

Commit dbc0c51

Browse files
committed
fix: constructor exposure
1 parent 9d57772 commit dbc0c51

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

array.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ ArrayIterator = module.exports = function (arr, kind) {
1818
};
1919
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
2020

21+
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
22+
delete ArrayIterator.prototype.constructor;
23+
2124
ArrayIterator.prototype = Object.create(Iterator.prototype, {
22-
constructor: d(ArrayIterator),
2325
_resolve: d(function (i) {
2426
if (this.__kind__ === "value") return this.__list__[i];
2527
if (this.__kind__ === "key+value") return [i, this.__list__[i]];

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ module.exports = Iterator = function (list, context) {
2424
context.on("_clear", this._onClear);
2525
};
2626

27+
// Internal %IteratorPrototype% doesn't expose its constructor
28+
delete Iterator.prototype.constructor;
29+
2730
defineProperties(
2831
Iterator.prototype,
2932
assign(
3033
{
31-
constructor: d(Iterator),
3234
_next: d(function () {
3335
var i;
3436
if (!this.__list__) return undefined;

string.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ StringIterator = module.exports = function (str) {
1717
};
1818
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
1919

20+
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
21+
delete StringIterator.prototype.constructor;
22+
2023
StringIterator.prototype = Object.create(Iterator.prototype, {
21-
constructor: d(StringIterator),
2224
_next: d(function () {
2325
if (!this.__list__) return undefined;
2426
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;

0 commit comments

Comments
 (0)