MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / encode_with_unstable

Method encode_with_unstable

out/cli.cjs:25709–25726  ·  view source on GitHub ↗

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

(text, allowed_special, disallowed_special)

Source from the content-addressed store, hash-verified

25707 * @returns {any}
25708 */
25709 encode_with_unstable(text, allowed_special, disallowed_special) {
25710 if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
25711 try {
25712 const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
25713 const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
25714 const len0 = WASM_VECTOR_LEN;
25715 wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
25716 var r0 = getInt32Memory0()[retptr / 4 + 0];
25717 var r1 = getInt32Memory0()[retptr / 4 + 1];
25718 var r22 = getInt32Memory0()[retptr / 4 + 2];
25719 if (r22) {
25720 throw takeObject(r1);
25721 }
25722 return takeObject(r0);
25723 } finally {
25724 wasm.__wbindgen_add_to_stack_pointer(16);
25725 }
25726 }
25727 /**
25728 * @param {Uint8Array} bytes
25729 * @returns {number}

Callers

nothing calls this directly

Calls 4

passStringToWasm0Function · 0.85
addHeapObjectFunction · 0.85
getInt32Memory0Function · 0.85
takeObjectFunction · 0.85

Tested by

no test coverage detected