diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-27 21:59:29 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-30 15:45:38 +0300 |
commit | 1f9a5ae7aadd073ac61933226687a4483f8eccf4 (patch) | |
tree | 2d07023ce21a0aa0339344ea513bce8490c27757 /lib/internal/readline | |
parent | 7fc5980cfe79c9b7ff19837397823a583c9fd8fe (diff) |
lib: use static Number properties from primordials
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/readline')
-rw-r--r-- | lib/internal/readline/utils.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index 27110f82797..510acf22183 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -2,6 +2,7 @@ const { Boolean, + NumberIsInteger, } = primordials; // Regex used for ansi escape code splitting @@ -38,7 +39,7 @@ if (internalBinding('config').hasIntl) { const icu = internalBinding('icu'); getStringWidth = function getStringWidth(str, options) { options = options || {}; - if (Number.isInteger(str)) { + if (NumberIsInteger(str)) { // Provide information about the character with code point 'str'. return icu.getStringWidth( str, @@ -76,7 +77,7 @@ if (internalBinding('config').hasIntl) { * Returns the number of columns required to display the given string. */ getStringWidth = function getStringWidth(str) { - if (Number.isInteger(str)) + if (NumberIsInteger(str)) return isFullWidthCodePoint(str) ? 2 : 1; let width = 0; @@ -107,7 +108,7 @@ if (internalBinding('config').hasIntl) { isFullWidthCodePoint = function isFullWidthCodePoint(code) { // Code points are derived from: // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt - return Number.isInteger(code) && code >= 0x1100 && ( + return NumberIsInteger(code) && code >= 0x1100 && ( code <= 0x115f || // Hangul Jamo code === 0x2329 || // LEFT-POINTING ANGLE BRACKET code === 0x232a || // RIGHT-POINTING ANGLE BRACKET |