@sebastianwessel/quickjs
Version:
A typescript package to execute JavaScript and TypeScript code in a WebAssembly QuickJS sandbox
22 lines (21 loc) • 821 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeURLSearchParams = void 0;
const helper_js_1 = require("../../helper.js");
const handleToNative_js_1 = require("../handleToNative.js");
const serializeURLSearchParams = (ctx, handle) => {
const h = new URLSearchParams();
ctx
.newFunction('', (value, name) => {
const v = (0, handleToNative_js_1.handleToNative)(ctx, value);
const n = (0, handleToNative_js_1.handleToNative)(ctx, name);
h.append(n, v);
})
.consume(f => {
(0, helper_js_1.call)(ctx, 'internal/serializer/serializeUrlSearchParams.js', `(h, fn) => {
h.forEach(fn)
}`, undefined, handle, f).dispose();
});
return h;
};
exports.serializeURLSearchParams = serializeURLSearchParams;