source: trip-planner-front/node_modules/is-fullwidth-code-point/index.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/* eslint-disable yoda */
2'use strict';
3
4const isFullwidthCodePoint = codePoint => {
5 if (Number.isNaN(codePoint)) {
6 return false;
7 }
8
9 // Code points are derived from:
10 // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
11 if (
12 codePoint >= 0x1100 && (
13 codePoint <= 0x115F || // Hangul Jamo
14 codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
15 codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
16 // CJK Radicals Supplement .. Enclosed CJK Letters and Months
17 (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
18 // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
19 (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
20 // CJK Unified Ideographs .. Yi Radicals
21 (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
22 // Hangul Jamo Extended-A
23 (0xA960 <= codePoint && codePoint <= 0xA97C) ||
24 // Hangul Syllables
25 (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
26 // CJK Compatibility Ideographs
27 (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
28 // Vertical Forms
29 (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
30 // CJK Compatibility Forms .. Small Form Variants
31 (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
32 // Halfwidth and Fullwidth Forms
33 (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
34 (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
35 // Kana Supplement
36 (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
37 // Enclosed Ideographic Supplement
38 (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
39 // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
40 (0x20000 <= codePoint && codePoint <= 0x3FFFD)
41 )
42 ) {
43 return true;
44 }
45
46 return false;
47};
48
49module.exports = isFullwidthCodePoint;
50module.exports.default = isFullwidthCodePoint;
Note: See TracBrowser for help on using the repository browser.