diff options
author | Jackson Tian <shyvo1987@gmail.com> | 2016-03-17 12:23:52 +0800 |
---|---|---|
committer | Benjamin Gruenbaum <inglor@gmail.com> | 2016-03-23 15:58:52 +0200 |
commit | 91466b855f0ced0df9a2d7444eea8ac7b89e278e (patch) | |
tree | 3b2db268ae1960f2343d414e527af8bdadbc6641 /lib/readline.js | |
parent | fb51c396ff823f8274bc4bea487da562ce57d75e (diff) | |
download | android-node-v8-91466b855f0ced0df9a2d7444eea8ac7b89e278e.tar.gz android-node-v8-91466b855f0ced0df9a2d7444eea8ac7b89e278e.tar.bz2 android-node-v8-91466b855f0ced0df9a2d7444eea8ac7b89e278e.zip |
lib: refactor code with startsWith/endsWith
reduce using RegExp for string test. This pull reuqest replaces
various usages of regular expressions in favor of the ES2015
startsWith and endsWith methods.
PR-URL: https://github.com/nodejs/node/pull/5753
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib/readline.js')
-rw-r--r-- | lib/readline.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/readline.js b/lib/readline.js index 065cc62807..3948d99053 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -335,7 +335,7 @@ Interface.prototype._normalWrite = function(b) { this._line_buffer = null; } if (newPartContainsEnding) { - this._sawReturn = /\r$/.test(string); + this._sawReturn = string.endsWith('\r'); // got one or more newlines; process into "line" events var lines = string.split(lineEnding); |