js-runtime: Add Value.eql function, equivalent to Js's === operator

This commit is contained in:
iddev5 2022-07-07 23:35:18 +05:30 committed by Stephen Gutekanst
parent 8ec61055e3
commit e67fdd75e3
2 changed files with 20 additions and 0 deletions

View file

@ -268,6 +268,13 @@ const zig = {
memory.setString(ptr, values[value_map[val_id]]);
},
zigValueEqual(val, other) {
let memory = new MemoryBlock(zig.wasm.exports.memory.buffer);
const val_js = zig.readObject(memory.slice(val), memory);
const other_js = zig.readObject(memory.slice(other), memory);
return val_js === other_js;
},
functionCall(func, this_param, args, args_len, ret_ptr) {
let memory = new MemoryBlock(zig.wasm.exports.memory.buffer);
let argv = [];