UNPKG

utf16-to-sjis

Version:

Tiny UTF-16 to Shift-JIS (CP932) converter.

25 lines 700 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UTF16_TO_SJIS = void 0; const data_js_1 = require("./g/data.js"); exports.UTF16_TO_SJIS = (() => { const res = {}; let pos = 0; let lastValue = 0; const inp = data_js_1.data.replace(/\n/g, ''); while (pos < inp.length) { let value; if (inp.charCodeAt(pos) < 0x80) { value = parseInt("0x" + inp.substring(pos, pos + 4)); pos += 4; } else { value = lastValue + 1; } const ch = inp.charCodeAt(pos++); res[ch] = value; lastValue = value; } return res; })(); //# sourceMappingURL=table.js.map