2 var numberIsNan = require('number-is-nan');
4 module.exports = function (x) {
9 // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
11 // code points are derived from:
12 // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
14 x <= 0x115f || // Hangul Jamo
15 0x2329 === x || // LEFT-POINTING ANGLE BRACKET
16 0x232a === x || // RIGHT-POINTING ANGLE BRACKET
17 // CJK Radicals Supplement .. Enclosed CJK Letters and Months
18 (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
19 // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
20 0x3250 <= x && x <= 0x4dbf ||
21 // CJK Unified Ideographs .. Yi Radicals
22 0x4e00 <= x && x <= 0xa4c6 ||
23 // Hangul Jamo Extended-A
24 0xa960 <= x && x <= 0xa97c ||
26 0xac00 <= x && x <= 0xd7a3 ||
27 // CJK Compatibility Ideographs
28 0xf900 <= x && x <= 0xfaff ||
30 0xfe10 <= x && x <= 0xfe19 ||
31 // CJK Compatibility Forms .. Small Form Variants
32 0xfe30 <= x && x <= 0xfe6b ||
33 // Halfwidth and Fullwidth Forms
34 0xff01 <= x && x <= 0xff60 ||
35 0xffe0 <= x && x <= 0xffe6 ||
37 0x1b000 <= x && x <= 0x1b001 ||
38 // Enclosed Ideographic Supplement
39 0x1f200 <= x && x <= 0x1f251 ||
40 // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
41 0x20000 <= x && x <= 0x3fffd)) {