jsontrek 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/bundle.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {string} obj
4
+ * @param {any} obj
5
5
  * @param {string} path
6
- * @returns {string}
6
+ * @returns {any}
7
7
  */
8
- export function parse(obj: string, path: string): string;
8
+ export function parse(obj: any, path: string): any;
package/bundle_bg.js CHANGED
@@ -4,6 +4,26 @@ export function __wbg_set_wasm(val) {
4
4
  }
5
5
 
6
6
 
7
+ const heap = new Array(128).fill(undefined);
8
+
9
+ heap.push(undefined, null, true, false);
10
+
11
+ function getObject(idx) { return heap[idx]; }
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
+
7
27
  let WASM_VECTOR_LEN = 0;
8
28
 
9
29
  let cachedUint8ArrayMemory0 = null;
@@ -71,6 +91,10 @@ function passStringToWasm0(arg, malloc, realloc) {
71
91
  return ptr;
72
92
  }
73
93
 
94
+ function isLikeNone(x) {
95
+ return x === undefined || x === null;
96
+ }
97
+
74
98
  let cachedDataViewMemory0 = null;
75
99
 
76
100
  function getDataViewMemory0() {
@@ -80,6 +104,15 @@ function getDataViewMemory0() {
80
104
  return cachedDataViewMemory0;
81
105
  }
82
106
 
107
+ function addHeapObject(obj) {
108
+ if (heap_next === heap.length) heap.push(heap.length + 1);
109
+ const idx = heap_next;
110
+ heap_next = heap[idx];
111
+
112
+ heap[idx] = obj;
113
+ return idx;
114
+ }
115
+
83
116
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
84
117
 
85
118
  let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -90,29 +123,339 @@ function getStringFromWasm0(ptr, len) {
90
123
  ptr = ptr >>> 0;
91
124
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
92
125
  }
126
+
127
+ function debugString(val) {
128
+ // primitive types
129
+ const type = typeof val;
130
+ if (type == 'number' || type == 'boolean' || val == null) {
131
+ return `${val}`;
132
+ }
133
+ if (type == 'string') {
134
+ return `"${val}"`;
135
+ }
136
+ if (type == 'symbol') {
137
+ const description = val.description;
138
+ if (description == null) {
139
+ return 'Symbol';
140
+ } else {
141
+ return `Symbol(${description})`;
142
+ }
143
+ }
144
+ if (type == 'function') {
145
+ const name = val.name;
146
+ if (typeof name == 'string' && name.length > 0) {
147
+ return `Function(${name})`;
148
+ } else {
149
+ return 'Function';
150
+ }
151
+ }
152
+ // objects
153
+ if (Array.isArray(val)) {
154
+ const length = val.length;
155
+ let debug = '[';
156
+ if (length > 0) {
157
+ debug += debugString(val[0]);
158
+ }
159
+ for(let i = 1; i < length; i++) {
160
+ debug += ', ' + debugString(val[i]);
161
+ }
162
+ debug += ']';
163
+ return debug;
164
+ }
165
+ // Test for built-in
166
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
167
+ let className;
168
+ if (builtInMatches.length > 1) {
169
+ className = builtInMatches[1];
170
+ } else {
171
+ // Failed to match the standard '[object ClassName]'
172
+ return toString.call(val);
173
+ }
174
+ if (className == 'Object') {
175
+ // we're a user defined class or Object
176
+ // JSON.stringify avoids problems with cycles, and is generally much
177
+ // easier than looping through ownProperties of `val`.
178
+ try {
179
+ return 'Object(' + JSON.stringify(val) + ')';
180
+ } catch (_) {
181
+ return 'Object';
182
+ }
183
+ }
184
+ // errors
185
+ if (val instanceof Error) {
186
+ return `${val.name}: ${val.message}\n${val.stack}`;
187
+ }
188
+ // TODO we could test for more things here, like `Set`s and `Map`s.
189
+ return className;
190
+ }
93
191
  /**
94
- * @param {string} obj
192
+ * @param {any} obj
95
193
  * @param {string} path
96
- * @returns {string}
194
+ * @returns {any}
97
195
  */
98
196
  export function parse(obj, path) {
99
- let deferred3_0;
100
- let deferred3_1;
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);
201
+ }
202
+
203
+ function handleError(f, args) {
101
204
  try {
102
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
103
- const ptr0 = passStringToWasm0(obj, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
104
- const len0 = WASM_VECTOR_LEN;
105
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
106
- const len1 = WASM_VECTOR_LEN;
107
- wasm.parse(retptr, ptr0, len0, ptr1, len1);
108
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
- deferred3_0 = r0;
111
- deferred3_1 = r1;
112
- return getStringFromWasm0(r0, r1);
113
- } finally {
114
- wasm.__wbindgen_add_to_stack_pointer(16);
115
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
205
+ return f.apply(this, args);
206
+ } catch (e) {
207
+ wasm.__wbindgen_exn_store(addHeapObject(e));
116
208
  }
117
209
  }
118
210
 
211
+ export function __wbindgen_object_drop_ref(arg0) {
212
+ takeObject(arg0);
213
+ };
214
+
215
+ export function __wbindgen_string_get(arg0, arg1) {
216
+ const obj = getObject(arg1);
217
+ const ret = typeof(obj) === 'string' ? obj : undefined;
218
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
219
+ var len1 = WASM_VECTOR_LEN;
220
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
221
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
222
+ };
223
+
224
+ export function __wbindgen_boolean_get(arg0) {
225
+ const v = getObject(arg0);
226
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
227
+ return ret;
228
+ };
229
+
230
+ export function __wbindgen_is_bigint(arg0) {
231
+ const ret = typeof(getObject(arg0)) === 'bigint';
232
+ return ret;
233
+ };
234
+
235
+ export function __wbindgen_number_get(arg0, arg1) {
236
+ const obj = getObject(arg1);
237
+ const ret = typeof(obj) === 'number' ? obj : undefined;
238
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
239
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
240
+ };
241
+
242
+ export function __wbindgen_is_object(arg0) {
243
+ const val = getObject(arg0);
244
+ const ret = typeof(val) === 'object' && val !== null;
245
+ return ret;
246
+ };
247
+
248
+ export function __wbindgen_in(arg0, arg1) {
249
+ const ret = getObject(arg0) in getObject(arg1);
250
+ return ret;
251
+ };
252
+
253
+ export function __wbindgen_bigint_from_i64(arg0) {
254
+ const ret = arg0;
255
+ return addHeapObject(ret);
256
+ };
257
+
258
+ export function __wbindgen_jsval_eq(arg0, arg1) {
259
+ const ret = getObject(arg0) === getObject(arg1);
260
+ return ret;
261
+ };
262
+
263
+ export function __wbindgen_bigint_from_u64(arg0) {
264
+ const ret = BigInt.asUintN(64, arg0);
265
+ return addHeapObject(ret);
266
+ };
267
+
268
+ export function __wbindgen_error_new(arg0, arg1) {
269
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
270
+ return addHeapObject(ret);
271
+ };
272
+
273
+ export function __wbindgen_is_string(arg0) {
274
+ const ret = typeof(getObject(arg0)) === 'string';
275
+ return ret;
276
+ };
277
+
278
+ export function __wbindgen_jsval_loose_eq(arg0, arg1) {
279
+ const ret = getObject(arg0) == getObject(arg1);
280
+ return ret;
281
+ };
282
+
283
+ export function __wbindgen_number_new(arg0) {
284
+ const ret = arg0;
285
+ return addHeapObject(ret);
286
+ };
287
+
288
+ export function __wbindgen_string_new(arg0, arg1) {
289
+ const ret = getStringFromWasm0(arg0, arg1);
290
+ return addHeapObject(ret);
291
+ };
292
+
293
+ export function __wbg_set_f975102236d3c502(arg0, arg1, arg2) {
294
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
295
+ };
296
+
297
+ export function __wbg_get_5419cf6b954aa11d(arg0, arg1) {
298
+ const ret = getObject(arg0)[arg1 >>> 0];
299
+ return addHeapObject(ret);
300
+ };
301
+
302
+ export function __wbg_length_f217bbbf7e8e4df4(arg0) {
303
+ const ret = getObject(arg0).length;
304
+ return ret;
305
+ };
306
+
307
+ export function __wbg_new_034f913e7636e987() {
308
+ const ret = new Array();
309
+ return addHeapObject(ret);
310
+ };
311
+
312
+ export function __wbindgen_is_function(arg0) {
313
+ const ret = typeof(getObject(arg0)) === 'function';
314
+ return ret;
315
+ };
316
+
317
+ export function __wbg_new_7a87a0376e40533b() {
318
+ const ret = new Map();
319
+ return addHeapObject(ret);
320
+ };
321
+
322
+ export function __wbg_next_13b477da1eaa3897(arg0) {
323
+ const ret = getObject(arg0).next;
324
+ return addHeapObject(ret);
325
+ };
326
+
327
+ export function __wbg_next_b06e115d1b01e10b() { return handleError(function (arg0) {
328
+ const ret = getObject(arg0).next();
329
+ return addHeapObject(ret);
330
+ }, arguments) };
331
+
332
+ export function __wbg_done_983b5ffcaec8c583(arg0) {
333
+ const ret = getObject(arg0).done;
334
+ return ret;
335
+ };
336
+
337
+ export function __wbg_value_2ab8a198c834c26a(arg0) {
338
+ const ret = getObject(arg0).value;
339
+ return addHeapObject(ret);
340
+ };
341
+
342
+ export function __wbg_iterator_695d699a44d6234c() {
343
+ const ret = Symbol.iterator;
344
+ return addHeapObject(ret);
345
+ };
346
+
347
+ export function __wbg_get_ef828680c64da212() { return handleError(function (arg0, arg1) {
348
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
349
+ return addHeapObject(ret);
350
+ }, arguments) };
351
+
352
+ export function __wbg_call_a9ef466721e824f2() { return handleError(function (arg0, arg1) {
353
+ const ret = getObject(arg0).call(getObject(arg1));
354
+ return addHeapObject(ret);
355
+ }, arguments) };
356
+
357
+ export function __wbg_new_e69b5f66fda8f13c() {
358
+ const ret = new Object();
359
+ return addHeapObject(ret);
360
+ };
361
+
362
+ export function __wbg_set_425e70f7c64ac962(arg0, arg1, arg2) {
363
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
364
+ };
365
+
366
+ export function __wbg_isArray_6f3b47f09adb61b5(arg0) {
367
+ const ret = Array.isArray(getObject(arg0));
368
+ return ret;
369
+ };
370
+
371
+ export function __wbg_instanceof_ArrayBuffer_74945570b4a62ec7(arg0) {
372
+ let result;
373
+ try {
374
+ result = getObject(arg0) instanceof ArrayBuffer;
375
+ } catch (_) {
376
+ result = false;
377
+ }
378
+ const ret = result;
379
+ return ret;
380
+ };
381
+
382
+ export function __wbg_instanceof_Map_f96986929e7e89ed(arg0) {
383
+ let result;
384
+ try {
385
+ result = getObject(arg0) instanceof Map;
386
+ } catch (_) {
387
+ result = false;
388
+ }
389
+ const ret = result;
390
+ return ret;
391
+ };
392
+
393
+ export function __wbg_set_277a63e77c89279f(arg0, arg1, arg2) {
394
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
395
+ return addHeapObject(ret);
396
+ };
397
+
398
+ export function __wbg_isSafeInteger_b9dff570f01a9100(arg0) {
399
+ const ret = Number.isSafeInteger(getObject(arg0));
400
+ return ret;
401
+ };
402
+
403
+ export function __wbg_entries_c02034de337d3ee2(arg0) {
404
+ const ret = Object.entries(getObject(arg0));
405
+ return addHeapObject(ret);
406
+ };
407
+
408
+ export function __wbg_buffer_ccaed51a635d8a2d(arg0) {
409
+ const ret = getObject(arg0).buffer;
410
+ return addHeapObject(ret);
411
+ };
412
+
413
+ export function __wbg_new_fec2611eb9180f95(arg0) {
414
+ const ret = new Uint8Array(getObject(arg0));
415
+ return addHeapObject(ret);
416
+ };
417
+
418
+ export function __wbg_set_ec2fcf81bc573fd9(arg0, arg1, arg2) {
419
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
420
+ };
421
+
422
+ export function __wbg_length_9254c4bd3b9f23c4(arg0) {
423
+ const ret = getObject(arg0).length;
424
+ return ret;
425
+ };
426
+
427
+ export function __wbg_instanceof_Uint8Array_df0761410414ef36(arg0) {
428
+ let result;
429
+ try {
430
+ result = getObject(arg0) instanceof Uint8Array;
431
+ } catch (_) {
432
+ result = false;
433
+ }
434
+ const ret = result;
435
+ return ret;
436
+ };
437
+
438
+ export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
439
+ const v = getObject(arg1);
440
+ const ret = typeof(v) === 'bigint' ? v : undefined;
441
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
442
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
443
+ };
444
+
445
+ export function __wbindgen_debug_string(arg0, arg1) {
446
+ const ret = debugString(getObject(arg1));
447
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ const len1 = WASM_VECTOR_LEN;
449
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
450
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
451
+ };
452
+
453
+ export function __wbindgen_throw(arg0, arg1) {
454
+ throw new Error(getStringFromWasm0(arg0, arg1));
455
+ };
456
+
457
+ export function __wbindgen_memory() {
458
+ const ret = wasm.memory;
459
+ return addHeapObject(ret);
460
+ };
461
+
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.1",
4
+ "version": "0.1.3",
5
5
  "files": [
6
6
  "bundle_bg.wasm",
7
7
  "bundle.js",