libchai 0.1.9 → 0.1.11

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/chai.d.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * @param {any} js_config
5
+ * @returns {any}
5
6
  */
6
- export function validate(js_config: any): void;
7
+ export function validate(js_config: any): any;
7
8
  /**
8
9
  * @param {any} js_input
9
10
  * @returns {any}
package/chai.js CHANGED
@@ -20,33 +20,6 @@ function takeObject(idx) {
20
20
  return ret;
21
21
  }
22
22
 
23
- function addHeapObject(obj) {
24
- if (heap_next === heap.length) heap.push(heap.length + 1);
25
- const idx = heap_next;
26
- heap_next = heap[idx];
27
-
28
- heap[idx] = obj;
29
- return idx;
30
- }
31
-
32
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
-
34
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
35
-
36
- let cachedUint8Memory0 = null;
37
-
38
- function getUint8Memory0() {
39
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
40
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
41
- }
42
- return cachedUint8Memory0;
43
- }
44
-
45
- function getStringFromWasm0(ptr, len) {
46
- ptr = ptr >>> 0;
47
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
48
- }
49
-
50
23
  function isLikeNone(x) {
51
24
  return x === undefined || x === null;
52
25
  }
@@ -71,6 +44,15 @@ function getInt32Memory0() {
71
44
 
72
45
  let WASM_VECTOR_LEN = 0;
73
46
 
47
+ let cachedUint8Memory0 = null;
48
+
49
+ function getUint8Memory0() {
50
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
51
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
52
+ }
53
+ return cachedUint8Memory0;
54
+ }
55
+
74
56
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
75
57
 
76
58
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -125,6 +107,24 @@ function passStringToWasm0(arg, malloc, realloc) {
125
107
  return ptr;
126
108
  }
127
109
 
110
+ function addHeapObject(obj) {
111
+ if (heap_next === heap.length) heap.push(heap.length + 1);
112
+ const idx = heap_next;
113
+ heap_next = heap[idx];
114
+
115
+ heap[idx] = obj;
116
+ return idx;
117
+ }
118
+
119
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
120
+
121
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
122
+
123
+ function getStringFromWasm0(ptr, len) {
124
+ ptr = ptr >>> 0;
125
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
126
+ }
127
+
128
128
  let cachedBigInt64Memory0 = null;
129
129
 
130
130
  function getBigInt64Memory0() {
@@ -200,6 +200,7 @@ function debugString(val) {
200
200
  }
201
201
  /**
202
202
  * @param {any} js_config
203
+ * @returns {any}
203
204
  */
204
205
  export function validate(js_config) {
205
206
  try {
@@ -207,9 +208,11 @@ export function validate(js_config) {
207
208
  wasm.validate(retptr, addHeapObject(js_config));
208
209
  var r0 = getInt32Memory0()[retptr / 4 + 0];
209
210
  var r1 = getInt32Memory0()[retptr / 4 + 1];
210
- if (r1) {
211
- throw takeObject(r0);
211
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
212
+ if (r2) {
213
+ throw takeObject(r1);
212
214
  }
215
+ return takeObject(r0);
213
216
  } finally {
214
217
  wasm.__wbindgen_add_to_stack_pointer(16);
215
218
  }
@@ -347,22 +350,6 @@ function __wbg_get_imports() {
347
350
  const ret = typeof(getObject(arg0)) === 'bigint';
348
351
  return ret;
349
352
  };
350
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
351
- const ret = arg0;
352
- return addHeapObject(ret);
353
- };
354
- imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
355
- const ret = getObject(arg0) === getObject(arg1);
356
- return ret;
357
- };
358
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
359
- const ret = BigInt.asUintN(64, arg0);
360
- return addHeapObject(ret);
361
- };
362
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
363
- const ret = new Error(getStringFromWasm0(arg0, arg1));
364
- return addHeapObject(ret);
365
- };
366
353
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
367
354
  const obj = getObject(arg1);
368
355
  const ret = typeof(obj) === 'number' ? obj : undefined;
@@ -386,6 +373,22 @@ function __wbg_get_imports() {
386
373
  const ret = getObject(arg0) in getObject(arg1);
387
374
  return ret;
388
375
  };
376
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
377
+ const ret = arg0;
378
+ return addHeapObject(ret);
379
+ };
380
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
381
+ const ret = getObject(arg0) === getObject(arg1);
382
+ return ret;
383
+ };
384
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
385
+ const ret = BigInt.asUintN(64, arg0);
386
+ return addHeapObject(ret);
387
+ };
388
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
389
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
390
+ return addHeapObject(ret);
391
+ };
389
392
  imports.wbg.__wbindgen_is_string = function(arg0) {
390
393
  const ret = typeof(getObject(arg0)) === 'string';
391
394
  return ret;
@@ -394,6 +397,14 @@ function __wbg_get_imports() {
394
397
  const ret = getObject(arg0) === undefined;
395
398
  return ret;
396
399
  };
400
+ imports.wbg.__wbindgen_number_new = function(arg0) {
401
+ const ret = arg0;
402
+ return addHeapObject(ret);
403
+ };
404
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
405
+ const ret = getStringFromWasm0(arg0, arg1);
406
+ return addHeapObject(ret);
407
+ };
397
408
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
398
409
  const ret = getObject(arg0) == getObject(arg1);
399
410
  return ret;
@@ -402,18 +413,17 @@ function __wbg_get_imports() {
402
413
  const ret = +getObject(arg0);
403
414
  return ret;
404
415
  };
405
- imports.wbg.__wbindgen_number_new = function(arg0) {
406
- const ret = arg0;
407
- return addHeapObject(ret);
416
+ imports.wbg.__wbg_String_389b54bd9d25375f = function(arg0, arg1) {
417
+ const ret = String(getObject(arg1));
418
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
419
+ const len1 = WASM_VECTOR_LEN;
420
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
421
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
408
422
  };
409
423
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
410
424
  const ret = getObject(arg0);
411
425
  return addHeapObject(ret);
412
426
  };
413
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
414
- const ret = getStringFromWasm0(arg0, arg1);
415
- return addHeapObject(ret);
416
- };
417
427
  imports.wbg.__wbg_getwithrefkey_4a92a5eca60879b9 = function(arg0, arg1) {
418
428
  const ret = getObject(arg0)[getObject(arg1)];
419
429
  return addHeapObject(ret);
@@ -421,13 +431,6 @@ function __wbg_get_imports() {
421
431
  imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
422
432
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
423
433
  };
424
- imports.wbg.__wbg_String_389b54bd9d25375f = function(arg0, arg1) {
425
- const ret = String(getObject(arg1));
426
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
427
- const len1 = WASM_VECTOR_LEN;
428
- getInt32Memory0()[arg0 / 4 + 1] = len1;
429
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
430
- };
431
434
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
432
435
  const ret = new Error();
433
436
  return addHeapObject(ret);
@@ -474,10 +477,6 @@ function __wbg_get_imports() {
474
477
  const ret = getObject(arg0).node;
475
478
  return addHeapObject(ret);
476
479
  };
477
- imports.wbg.__wbg_msCrypto_10fc94afee92bd76 = function(arg0) {
478
- const ret = getObject(arg0).msCrypto;
479
- return addHeapObject(ret);
480
- };
481
480
  imports.wbg.__wbg_require_9a7e0f667ead4995 = function() { return handleError(function () {
482
481
  const ret = module.require;
483
482
  return addHeapObject(ret);
@@ -486,6 +485,10 @@ function __wbg_get_imports() {
486
485
  const ret = typeof(getObject(arg0)) === 'function';
487
486
  return ret;
488
487
  };
488
+ imports.wbg.__wbg_msCrypto_10fc94afee92bd76 = function(arg0) {
489
+ const ret = getObject(arg0).msCrypto;
490
+ return addHeapObject(ret);
491
+ };
489
492
  imports.wbg.__wbg_randomFillSync_b70ccbdf4926a99d = function() { return handleError(function (arg0, arg1) {
490
493
  getObject(arg0).randomFillSync(takeObject(arg1));
491
494
  }, arguments) };
package/chai_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Songchen Tan <i@tansongchen.com>"
5
5
  ],
6
- "version": "0.1.9",
6
+ "version": "0.1.11",
7
7
  "files": [
8
8
  "chai_bg.wasm",
9
9
  "chai.js",