jsontrek 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.d.ts CHANGED
@@ -3,6 +3,6 @@
3
3
  /**
4
4
  * @param {any} obj
5
5
  * @param {string} path
6
- * @returns {any}
6
+ * @returns {any[]}
7
7
  */
8
- export function parse(obj: any, path: string): any;
8
+ export function parse(obj: any, path: string): any[];
package/bundle_bg.js CHANGED
@@ -188,16 +188,35 @@ function debugString(val) {
188
188
  // TODO we could test for more things here, like `Set`s and `Map`s.
189
189
  return className;
190
190
  }
191
+
192
+ function getArrayJsValueFromWasm0(ptr, len) {
193
+ ptr = ptr >>> 0;
194
+ const mem = getDataViewMemory0();
195
+ const result = [];
196
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
197
+ result.push(takeObject(mem.getUint32(i, true)));
198
+ }
199
+ return result;
200
+ }
191
201
  /**
192
202
  * @param {any} obj
193
203
  * @param {string} path
194
- * @returns {any}
204
+ * @returns {any[]}
195
205
  */
196
206
  export function parse(obj, path) {
197
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
198
- const len0 = WASM_VECTOR_LEN;
199
- const ret = wasm.parse(addHeapObject(obj), ptr0, len0);
200
- return takeObject(ret);
207
+ try {
208
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
209
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
210
+ const len0 = WASM_VECTOR_LEN;
211
+ wasm.parse(retptr, addHeapObject(obj), ptr0, len0);
212
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
213
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
214
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
215
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
216
+ return v2;
217
+ } finally {
218
+ wasm.__wbindgen_add_to_stack_pointer(16);
219
+ }
201
220
  }
202
221
 
203
222
  function handleError(f, args) {
package/bundle_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jsontrek",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "files": [
6
6
  "bundle_bg.wasm",
7
7
  "bundle.js",