From a0b1aa1161de365de63093a8ad9f4eb6d4e5cc1e Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Feb 2017 18:15:36 -0800 Subject: [PATCH] readline: avoid using forEach PR-URL: https://github.com/nodejs/node/pull/11582 Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig --- lib/readline.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/readline.js b/lib/readline.js index a571657a726d2a..52bdd976155439 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -371,9 +371,8 @@ Interface.prototype._normalWrite = function(b) { // either '' or (conceivably) the unfinished portion of the next line string = lines.pop(); this._line_buffer = string; - lines.forEach(function(line) { - this._onLine(line); - }, this); + for (var n = 0; n < lines.length; n++) + this._onLine(lines[n]); } else if (string) { // no newlines this time, save what we have for next time this._line_buffer = string;