MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / charConvert

Function charConvert

scripts/createInvisibleText.js:226–237  ·  view source on GitHub ↗
(char)

Source from the content-addressed store, hash-verified

224const BASE = CHARS.length;
225const LEN = lenCalc(BASE, UNICODE_CHARS);
226const charConvert = (char) => {
227 let charCode = char.codePointAt(0);
228 let arr = [];
229 while (charCode > 0) {
230 arr.push(charCode % BASE);
231 charCode = ~~(charCode / BASE);
232 }
233 while (arr.length < LEN) {
234 arr.push(0);
235 }
236 return arr.reverse();
237};
238const charEncode = (convertedChar) => {
239 return convertedChar.reduce((curr, digit) => curr + CHARS[digit], "");
240};

Callers 1

_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected