diff options
Diffstat (limited to 'lib/internal/readline/utils.js')
-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 27110f8279..510acf2218 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 |