jsontrek 0.1.3 → 0.1.7

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
@@ -10,20 +10,6 @@ heap.push(undefined, null, true, false);
10
10
 
11
11
  function getObject(idx) { return heap[idx]; }
12
12
 
13
- let heap_next = heap.length;
14
-
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
19
- }
20
-
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
25
- }
26
-
27
13
  let WASM_VECTOR_LEN = 0;
28
14
 
29
15
  let cachedUint8ArrayMemory0 = null;
@@ -104,6 +90,20 @@ function getDataViewMemory0() {
104
90
  return cachedDataViewMemory0;
105
91
  }
106
92
 
93
+ let heap_next = heap.length;
94
+
95
+ function dropObject(idx) {
96
+ if (idx < 132) return;
97
+ heap[idx] = heap_next;
98
+ heap_next = idx;
99
+ }
100
+
101
+ function takeObject(idx) {
102
+ const ret = getObject(idx);
103
+ dropObject(idx);
104
+ return ret;
105
+ }
106
+
107
107
  function addHeapObject(obj) {
108
108
  if (heap_next === heap.length) heap.push(heap.length + 1);
109
109
  const idx = heap_next;
@@ -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) {
@@ -208,10 +227,6 @@ function handleError(f, args) {
208
227
  }
209
228
  }
210
229
 
211
- export function __wbindgen_object_drop_ref(arg0) {
212
- takeObject(arg0);
213
- };
214
-
215
230
  export function __wbindgen_string_get(arg0, arg1) {
216
231
  const obj = getObject(arg1);
217
232
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -221,6 +236,10 @@ export function __wbindgen_string_get(arg0, arg1) {
221
236
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
222
237
  };
223
238
 
239
+ export function __wbindgen_object_drop_ref(arg0) {
240
+ takeObject(arg0);
241
+ };
242
+
224
243
  export function __wbindgen_boolean_get(arg0) {
225
244
  const v = getObject(arg0);
226
245
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
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.7",
5
5
  "files": [
6
6
  "bundle_bg.wasm",
7
7
  "bundle.js",