Skip to content

Commit

Permalink
[Fix] don’t assume Array#forEach, for ES3.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 21, 2016
1 parent c9b8ce8 commit cc9cc30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var EventEmitter = require('events').EventEmitter;
var has = require('has');
var trim = require('string.prototype.trim');
var bind = require('function-bind');
var forEach = require('for-each');
var isEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);

module.exports = Test;
Expand Down Expand Up @@ -110,7 +111,7 @@ Test.prototype.test = function (name, opts, cb) {

Test.prototype.comment = function (msg) {
var that = this;
trim(msg).split('\n').forEach(function (aMsg) {
forEach(trim(msg).split('\n'), function (aMsg) {
that.emit('result', trim(aMsg).replace(/^#\s*/, ''));
});
};
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"deep-equal": "~1.0.1",
"defined": "~1.0.0",
"for-each": "~0.3.2",
"function-bind": "~1.1.0",
"glob": "~7.1.0",
"has": "~1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion test/end-as-callback.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var tap = require("tap");
var forEach = require("for-each");
var tape = require("../");
var concat = require('concat-stream');

Expand Down Expand Up @@ -67,7 +68,7 @@ function fakeAsyncWriteFail(name, cb) {
function getStackTrace(rows) {
var stacktrace = ' ---\n';
var extract = false;
rows.toString('utf8').split('\n').forEach(function (row) {
forEach(rows.toString('utf8').split('\n'), function (row) {
if (!extract) {
if (row.indexOf('---') > -1) { // start of stack trace
extract = true;
Expand Down

0 comments on commit cc9cc30

Please sign in to comment.