@lazy-cjk/fullhalf-char-code
Version:
Determines whether the specified character code is full-width or half-width.
23 lines (22 loc) • 1.27 kB
JavaScript
!function(e, l) {
"object" == typeof exports && "undefined" != typeof module ? l(exports) : "function" == typeof define && define.amd ? define([ "exports" ], l) : l((e = "undefined" != typeof globalThis ? globalThis : e || self).LazyCjkFullhalfCharCode = {});
}(this, (function(e) {
"use strict";
var l;
function detectFullHalfCharCode(e) {
return 0x0020 <= e && e < 0x007F ? 0 : 0x3000 === e || 0xFF00 < e && e < 0xFF5F ? 1 : -1;
}
e.EnumFullHalfTableType = void 0, (l = e.EnumFullHalfTableType || (e.EnumFullHalfTableType = {}))[l.FULL_WIDTH = 1] = "FULL_WIDTH",
l[l.HALF_WIDTH = 0] = "HALF_WIDTH", l[l.NO_EXIST = -1] = "NO_EXIST", e.detectFullHalfCharCode = detectFullHalfCharCode,
e.isFullHalfCharCode = function isFullHalfCharCode(e) {
const l = detectFullHalfCharCode(e);
return 1 === l || 0 !== l && null;
}, e.toFullWidthCharCode = function toFullWidthCharCode(e) {
return 0x0020 < e && e < 0x007F ? e - 0x0020 + 0xFF00 : 0x0020 === e ? 0x3000 : e;
}, e.toHalfWidthCharCode = function toHalfWidthCharCode(e) {
return 0xFF00 < e && e < 0xFF5F ? e - 0xFF00 + 0x0020 : 0x3000 === e ? 0x0020 : e;
}, Object.defineProperty(e, "__esModule", {
value: !0
});
}));
//# sourceMappingURL=index.umd.production.min.cjs.map