Skip to content

Commit f496839

Browse files
committed
don't store input in enumerator
1 parent 10a6859 commit f496839

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/es6-promise/enumerator.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function Enumerator(Constructor, input) {
3131
}
3232

3333
if (isArray(input)) {
34-
this._input = input;
3534
this.length = input.length;
3635
this._remaining = input.length;
3736

@@ -41,7 +40,7 @@ function Enumerator(Constructor, input) {
4140
fulfill(this.promise, this._result);
4241
} else {
4342
this.length = this.length || 0;
44-
this._enumerate();
43+
this._enumerate(input);
4544
if (this._remaining === 0) {
4645
fulfill(this.promise, this._result);
4746
}
@@ -55,11 +54,9 @@ function validationError() {
5554
return new Error('Array Methods must be provided an Array');
5655
};
5756

58-
Enumerator.prototype._enumerate = function() {
59-
let { length, _input } = this;
60-
61-
for (let i = 0; this._state === PENDING && i < length; i++) {
62-
this._eachEntry(_input[i], i);
57+
Enumerator.prototype._enumerate = function(input) {
58+
for (let i = 0; this._state === PENDING && i < input.length; i++) {
59+
this._eachEntry(input[i], i);
6360
}
6461
};
6562

0 commit comments

Comments
 (0)