UNPKG

@kintone/plugin-packer

Version:

Package your kintone plugin with pure JavaScript

23 lines 681 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hex2a = void 0; const N_TO_A = "a".charCodeAt(0) - "0".charCodeAt(0); const A_TO_K = "k".charCodeAt(0) - "a".charCodeAt(0); /** * `tr '0-9a-f' 'a-p'` in JS */ const hex2a = (hex) => { return Array.from(hex) .map((s) => { if (s >= "0" && s <= "9") { return String.fromCharCode(s.charCodeAt(0) + N_TO_A); } else if (s >= "a" && s <= "f") { return String.fromCharCode(s.charCodeAt(0) + A_TO_K); } throw new Error(`invalid char: ${s}`); }) .join(""); }; exports.hex2a = hex2a; //# sourceMappingURL=hex2a.js.map