Projekt

Obecné

Profil

Stáhnout (1.36 KB) Statistiky
| Větev: | Revize:
1
'use strict';
2
/* eslint-disable yoda */
3
module.exports = x => {
4
	if (Number.isNaN(x)) {
5
		return false;
6
	}
7

    
8
	// code points are derived from:
9
	// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
10
	if (
11
		x >= 0x1100 && (
12
			x <= 0x115f ||  // Hangul Jamo
13
			x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
14
			x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
15
			// CJK Radicals Supplement .. Enclosed CJK Letters and Months
16
			(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
17
			// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
18
			(0x3250 <= x && x <= 0x4dbf) ||
19
			// CJK Unified Ideographs .. Yi Radicals
20
			(0x4e00 <= x && x <= 0xa4c6) ||
21
			// Hangul Jamo Extended-A
22
			(0xa960 <= x && x <= 0xa97c) ||
23
			// Hangul Syllables
24
			(0xac00 <= x && x <= 0xd7a3) ||
25
			// CJK Compatibility Ideographs
26
			(0xf900 <= x && x <= 0xfaff) ||
27
			// Vertical Forms
28
			(0xfe10 <= x && x <= 0xfe19) ||
29
			// CJK Compatibility Forms .. Small Form Variants
30
			(0xfe30 <= x && x <= 0xfe6b) ||
31
			// Halfwidth and Fullwidth Forms
32
			(0xff01 <= x && x <= 0xff60) ||
33
			(0xffe0 <= x && x <= 0xffe6) ||
34
			// Kana Supplement
35
			(0x1b000 <= x && x <= 0x1b001) ||
36
			// Enclosed Ideographic Supplement
37
			(0x1f200 <= x && x <= 0x1f251) ||
38
			// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
39
			(0x20000 <= x && x <= 0x3fffd)
40
		)
41
	) {
42
		return true;
43
	}
44

    
45
	return false;
46
};
(1-1/4)