github-pages-deploy-action/node_modules/is-fullwidth-code-point/index.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-03-31 20:40:00 +08:00
'use strict';
2020-03-31 20:57:48 +08:00
/* eslint-disable yoda */
module.exports = x => {
if (Number.isNaN(x)) {
2020-01-28 13:07:56 +08:00
return false;
}
2020-03-31 20:57:48 +08:00
// code points are derived from:
2020-01-28 13:07:56 +08:00
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
if (
2020-03-31 20:57:48 +08:00
x >= 0x1100 && (
x <= 0x115f || // Hangul Jamo
x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
2020-01-28 13:07:56 +08:00
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
2020-03-31 20:57:48 +08:00
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
2020-01-28 13:07:56 +08:00
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
2020-03-31 20:57:48 +08:00
(0x3250 <= x && x <= 0x4dbf) ||
2020-01-28 13:07:56 +08:00
// CJK Unified Ideographs .. Yi Radicals
2020-03-31 20:57:48 +08:00
(0x4e00 <= x && x <= 0xa4c6) ||
2020-01-28 13:07:56 +08:00
// Hangul Jamo Extended-A
2020-03-31 20:57:48 +08:00
(0xa960 <= x && x <= 0xa97c) ||
2020-01-28 13:07:56 +08:00
// Hangul Syllables
2020-03-31 20:57:48 +08:00
(0xac00 <= x && x <= 0xd7a3) ||
2020-01-28 13:07:56 +08:00
// CJK Compatibility Ideographs
2020-03-31 20:57:48 +08:00
(0xf900 <= x && x <= 0xfaff) ||
2020-01-28 13:07:56 +08:00
// Vertical Forms
2020-03-31 20:57:48 +08:00
(0xfe10 <= x && x <= 0xfe19) ||
2020-01-28 13:07:56 +08:00
// CJK Compatibility Forms .. Small Form Variants
2020-03-31 20:57:48 +08:00
(0xfe30 <= x && x <= 0xfe6b) ||
2020-01-28 13:07:56 +08:00
// Halfwidth and Fullwidth Forms
2020-03-31 20:57:48 +08:00
(0xff01 <= x && x <= 0xff60) ||
(0xffe0 <= x && x <= 0xffe6) ||
2020-01-28 13:07:56 +08:00
// Kana Supplement
2020-03-31 20:57:48 +08:00
(0x1b000 <= x && x <= 0x1b001) ||
2020-01-28 13:07:56 +08:00
// Enclosed Ideographic Supplement
2020-03-31 20:57:48 +08:00
(0x1f200 <= x && x <= 0x1f251) ||
2020-01-28 13:07:56 +08:00
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
2020-03-31 20:57:48 +08:00
(0x20000 <= x && x <= 0x3fffd)
2020-01-28 13:07:56 +08:00
)
) {
return true;
}
return false;
};