UNPKG

@neox/arraybuffer-fns

Version:
148 lines (145 loc) 1.53 kB
// helper function for generating LOOKUP_BASE64: // function createLookup_LOOKUP_BASE64(): number[] { // const b64 = // "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; // // 0... 122 --> 123 Elements // const lookup_LOOKUP_BASE64 = new Array(123); // for (let i = 0; i <= 122; i++) { // const idx = b64.indexOf(String.fromCharCode(i)); // if (idx !== -1) { // lookup_LOOKUP_BASE64[i] = idx; // continue; // } // lookup_LOOKUP_BASE64[i] = null; // } // console.log("lookup_LOOKUP_BASE64:", lookup_LOOKUP_BASE64); // console.log("string:", lookup_LOOKUP_BASE64.join(", ")); // return lookup_LOOKUP_BASE64; // } export const B64_SET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; export const LOOKUP_BASE64 = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, ];