MCPcopy
hub / github.com/di-sukharev/opencommit / encode

Method encode

out/cli.cjs:25662–25682  ·  view source on GitHub ↗

* @param {string} text * @param {any} allowed_special * @param {any} disallowed_special * @returns {Uint32Array}

(text, allowed_special, disallowed_special)

Source from the content-addressed store, hash-verified

25660 * @returns {Uint32Array}
25661 */
25662 encode(text, allowed_special, disallowed_special) {
25663 if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
25664 try {
25665 const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
25666 const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
25667 const len0 = WASM_VECTOR_LEN;
25668 wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
25669 var r0 = getInt32Memory0()[retptr / 4 + 0];
25670 var r1 = getInt32Memory0()[retptr / 4 + 1];
25671 var r22 = getInt32Memory0()[retptr / 4 + 2];
25672 var r3 = getInt32Memory0()[retptr / 4 + 3];
25673 if (r3) {
25674 throw takeObject(r22);
25675 }
25676 var v22 = getArrayU32FromWasm0(r0, r1).slice();
25677 wasm.__wbindgen_export_2(r0, r1 * 4, 4);
25678 return v22;
25679 } finally {
25680 wasm.__wbindgen_add_to_stack_pointer(16);
25681 }
25682 }
25683 /**
25684 * @param {string} text
25685 * @returns {Uint32Array}

Callers 15

toASCIIFunction · 0.80
utf8EncodeFunction · 0.80
constructorMethod · 0.80
passStringToWasm0Function · 0.80
stringToBytesFunction · 0.80
stringPercentDecodeFunction · 0.80
processBlobPartsFunction · 0.80
pullFunction · 0.80
extractBodyFunction · 0.80
jsonMethod · 0.80
constructorMethod · 0.80

Calls 9

passStringToWasm0Function · 0.85
addHeapObjectFunction · 0.85
getInt32Memory0Function · 0.85
takeObjectFunction · 0.85
getArrayU32FromWasm0Function · 0.85
isFileLikeFunction · 0.85
sliceMethod · 0.45
valuesMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected