* @param {string} text * @param {any} allowed_special * @param {any} disallowed_special * @returns {Uint32Array}
(text, allowed_special, disallowed_special)
| 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} |
no test coverage detected