Skip to content

Commit

Permalink
Don't add the Array.prototype.forEach replacement to files that don't…
Browse files Browse the repository at this point in the history
… use forEach. (#331)
  • Loading branch information
realityking authored and mcollina committed Apr 3, 2018
1 parent 06058f0 commit 9481763
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
7 changes: 0 additions & 7 deletions build/files.js
Expand Up @@ -36,8 +36,6 @@ const headRegexp = /(^module.exports = \w+;?)/m
, '\n$1\n Duplex = Duplex || require(\'./_stream_duplex\');\n'
]

, altForEachImplReplacement = require('./common-replacements').altForEachImplReplacement
, altForEachUseReplacement = require('./common-replacements').altForEachUseReplacement
, altIndexOfImplReplacement = require('./common-replacements').altIndexOfImplReplacement
, altIndexOfUseReplacement = require('./common-replacements').altIndexOfUseReplacement

Expand Down Expand Up @@ -238,8 +236,6 @@ module.exports['_stream_duplex.js'] = [
, instanceofReplacement
, utilReplacement
, stringDecoderReplacement
, altForEachImplReplacement
, altForEachUseReplacement
, objectKeysReplacement
, objectKeysDefine
, processNextTickImport
Expand All @@ -258,11 +254,8 @@ module.exports['_stream_readable.js'] = [
, addDuplexDec
, requireReplacement
, instanceofReplacement
, altForEachImplReplacement
, altForEachUseReplacement
, altIndexOfImplReplacement
, altIndexOfUseReplacement
, instanceofReplacement
, stringDecoderReplacement
, isArrayReplacement
, isArrayDefine
Expand Down
8 changes: 1 addition & 7 deletions lib/_stream_duplex.js
Expand Up @@ -115,10 +115,4 @@ Duplex.prototype._destroy = function (err, cb) {
this.end();

pna.nextTick(cb, err);
};

function forEach(xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}
};
6 changes: 0 additions & 6 deletions lib/_stream_readable.js
Expand Up @@ -1001,12 +1001,6 @@ function endReadableNT(state, stream) {
}
}

function forEach(xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}

function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
Expand Down

0 comments on commit 9481763

Please sign in to comment.