mol_schema 0.0.22 → 0.0.24
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/README.md +22 -20
- package/node.d.ts +375 -343
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +470 -175
- package/node.js.map +1 -1
- package/node.meta.tree +4 -1
- package/node.mjs +470 -175
- package/node.test.js +718 -361
- package/node.test.js.map +1 -1
- package/package.json +17 -6
- package/web.d.ts +375 -343
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +470 -175
- package/web.js.map +1 -1
- package/web.meta.tree +4 -1
- package/web.mjs +470 -175
- package/web.test.js +316 -22
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -72,34 +72,36 @@ var $;
|
|
|
72
72
|
static toString() {
|
|
73
73
|
return $$.$mol_func_name(this);
|
|
74
74
|
}
|
|
75
|
-
/** Type-
|
|
76
|
-
static check(
|
|
75
|
+
/** Type-predicate that checks value by schema. */
|
|
76
|
+
static check(value) {
|
|
77
77
|
try {
|
|
78
|
-
this.guard(
|
|
78
|
+
this.guard(value);
|
|
79
79
|
return true;
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
/** `instanceof` support */
|
|
86
|
+
static [Symbol.hasInstance](value) {
|
|
87
|
+
return this.check(value);
|
|
87
88
|
}
|
|
88
|
-
/**
|
|
89
|
+
/** Type-parser that fails of wrong values. */
|
|
89
90
|
static guard(value) {
|
|
90
91
|
return value;
|
|
91
92
|
}
|
|
92
|
-
/**
|
|
93
|
+
/** Type-caster that normalizes wrong values. */
|
|
93
94
|
static cast(value) {
|
|
94
95
|
try {
|
|
95
|
-
|
|
96
|
+
this.guard(value);
|
|
97
|
+
return value;
|
|
96
98
|
}
|
|
97
99
|
catch (error) {
|
|
98
100
|
return this.default;
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
/** Default value which conforms schema. */
|
|
102
|
-
static default =
|
|
104
|
+
static default = null;
|
|
103
105
|
}
|
|
104
106
|
$.$mol_schema_any = $mol_schema_any;
|
|
105
107
|
})($ || ($ = {}));
|
|
@@ -201,6 +203,241 @@ var $;
|
|
|
201
203
|
$.$mol_schema_string = $mol_schema_string;
|
|
202
204
|
})($ || ($ = {}));
|
|
203
205
|
|
|
206
|
+
;
|
|
207
|
+
"use strict";
|
|
208
|
+
var $;
|
|
209
|
+
(function ($) {
|
|
210
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
211
|
+
function $mol_ambient(overrides) {
|
|
212
|
+
return Object.setPrototypeOf(overrides, this || $);
|
|
213
|
+
}
|
|
214
|
+
$.$mol_ambient = $mol_ambient;
|
|
215
|
+
})($ || ($ = {}));
|
|
216
|
+
|
|
217
|
+
;
|
|
218
|
+
"use strict";
|
|
219
|
+
var $;
|
|
220
|
+
(function ($) {
|
|
221
|
+
const instances = new WeakSet();
|
|
222
|
+
/**
|
|
223
|
+
* Proxy that delegates all to lazy returned target.
|
|
224
|
+
*
|
|
225
|
+
* $mol_delegate( Array.prototype , ()=> fetch_array() )
|
|
226
|
+
*/
|
|
227
|
+
function $mol_delegate(proto, target) {
|
|
228
|
+
const proxy = new Proxy(proto, {
|
|
229
|
+
get: (_, field) => {
|
|
230
|
+
const obj = target();
|
|
231
|
+
let val = Reflect.get(obj, field);
|
|
232
|
+
if (typeof val === 'function') {
|
|
233
|
+
val = val.bind(obj);
|
|
234
|
+
}
|
|
235
|
+
return val;
|
|
236
|
+
},
|
|
237
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
238
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
239
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
240
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
241
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
242
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
243
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
244
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
245
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
246
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
247
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
248
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
249
|
+
});
|
|
250
|
+
instances.add(proxy);
|
|
251
|
+
return proxy;
|
|
252
|
+
}
|
|
253
|
+
$.$mol_delegate = $mol_delegate;
|
|
254
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
255
|
+
value: (obj) => instances.has(obj),
|
|
256
|
+
});
|
|
257
|
+
})($ || ($ = {}));
|
|
258
|
+
|
|
259
|
+
;
|
|
260
|
+
"use strict";
|
|
261
|
+
var $;
|
|
262
|
+
(function ($) {
|
|
263
|
+
$.$mol_owning_map = new WeakMap();
|
|
264
|
+
function $mol_owning_allow(having) {
|
|
265
|
+
try {
|
|
266
|
+
if (!having)
|
|
267
|
+
return false;
|
|
268
|
+
if (typeof having !== 'object' && typeof having !== 'function')
|
|
269
|
+
return false;
|
|
270
|
+
if (having instanceof $mol_delegate)
|
|
271
|
+
return false;
|
|
272
|
+
if (typeof having['destructor'] !== 'function')
|
|
273
|
+
return false;
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
$.$mol_owning_allow = $mol_owning_allow;
|
|
281
|
+
function $mol_owning_get(having, Owner) {
|
|
282
|
+
if (!$mol_owning_allow(having))
|
|
283
|
+
return null;
|
|
284
|
+
while (true) {
|
|
285
|
+
const owner = $.$mol_owning_map.get(having);
|
|
286
|
+
if (!owner)
|
|
287
|
+
return owner;
|
|
288
|
+
if (!Owner)
|
|
289
|
+
return owner;
|
|
290
|
+
if (owner instanceof Owner)
|
|
291
|
+
return owner;
|
|
292
|
+
having = owner;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
$.$mol_owning_get = $mol_owning_get;
|
|
296
|
+
function $mol_owning_check(owner, having) {
|
|
297
|
+
if (!$mol_owning_allow(having))
|
|
298
|
+
return false;
|
|
299
|
+
if ($.$mol_owning_map.get(having) !== owner)
|
|
300
|
+
return false;
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
$.$mol_owning_check = $mol_owning_check;
|
|
304
|
+
function $mol_owning_catch(owner, having) {
|
|
305
|
+
if (!$mol_owning_allow(having))
|
|
306
|
+
return false;
|
|
307
|
+
if ($.$mol_owning_map.get(having))
|
|
308
|
+
return false;
|
|
309
|
+
$.$mol_owning_map.set(having, owner);
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
$.$mol_owning_catch = $mol_owning_catch;
|
|
313
|
+
})($ || ($ = {}));
|
|
314
|
+
|
|
315
|
+
;
|
|
316
|
+
"use strict";
|
|
317
|
+
var $;
|
|
318
|
+
(function ($) {
|
|
319
|
+
function $mol_fail_hidden(error) {
|
|
320
|
+
throw error; /// Use 'Never Pause Here' breakpoint in DevTools or simply blackbox this script
|
|
321
|
+
}
|
|
322
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
323
|
+
})($ || ($ = {}));
|
|
324
|
+
|
|
325
|
+
;
|
|
326
|
+
"use strict";
|
|
327
|
+
|
|
328
|
+
;
|
|
329
|
+
"use strict";
|
|
330
|
+
var $;
|
|
331
|
+
(function ($) {
|
|
332
|
+
if (!Symbol.dispose)
|
|
333
|
+
Symbol.dispose = Symbol('Symbol.dispose');
|
|
334
|
+
class $mol_object2 {
|
|
335
|
+
static $ = $;
|
|
336
|
+
[Symbol.toStringTag];
|
|
337
|
+
[$mol_ambient_ref] = null;
|
|
338
|
+
get $() {
|
|
339
|
+
if (this[$mol_ambient_ref])
|
|
340
|
+
return this[$mol_ambient_ref];
|
|
341
|
+
const owner = $mol_owning_get(this);
|
|
342
|
+
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
343
|
+
}
|
|
344
|
+
set $(next) {
|
|
345
|
+
if (this[$mol_ambient_ref])
|
|
346
|
+
$mol_fail_hidden(new Error('Context already defined'));
|
|
347
|
+
this[$mol_ambient_ref] = next;
|
|
348
|
+
}
|
|
349
|
+
static create(init) {
|
|
350
|
+
const obj = new this;
|
|
351
|
+
if (init)
|
|
352
|
+
init(obj);
|
|
353
|
+
return obj;
|
|
354
|
+
}
|
|
355
|
+
static [Symbol.toPrimitive]() {
|
|
356
|
+
return this.toString();
|
|
357
|
+
}
|
|
358
|
+
static toString() {
|
|
359
|
+
return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
|
|
360
|
+
}
|
|
361
|
+
static toJSON() {
|
|
362
|
+
return this.toString();
|
|
363
|
+
}
|
|
364
|
+
static [$mol_key_handle]() {
|
|
365
|
+
return this.toString();
|
|
366
|
+
}
|
|
367
|
+
destructor() { }
|
|
368
|
+
static destructor() { }
|
|
369
|
+
[Symbol.dispose]() {
|
|
370
|
+
this.destructor();
|
|
371
|
+
}
|
|
372
|
+
//[ Symbol.toPrimitive ]( hint: string ) {
|
|
373
|
+
// return hint === 'number' ? this.valueOf() : this.toString()
|
|
374
|
+
//}
|
|
375
|
+
toString() {
|
|
376
|
+
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
$.$mol_object2 = $mol_object2;
|
|
380
|
+
})($ || ($ = {}));
|
|
381
|
+
|
|
382
|
+
;
|
|
383
|
+
"use strict";
|
|
384
|
+
var $;
|
|
385
|
+
(function ($) {
|
|
386
|
+
class $mol_wrapper extends $mol_object2 {
|
|
387
|
+
static wrap;
|
|
388
|
+
static run(task) {
|
|
389
|
+
return this.func(task)();
|
|
390
|
+
}
|
|
391
|
+
static func(func) {
|
|
392
|
+
return this.wrap(func);
|
|
393
|
+
}
|
|
394
|
+
static get class() {
|
|
395
|
+
return (Class) => {
|
|
396
|
+
const construct = (target, args) => new Class(...args);
|
|
397
|
+
const handler = {
|
|
398
|
+
construct: this.func(construct)
|
|
399
|
+
};
|
|
400
|
+
handler[Symbol.toStringTag] = Class.name + '#';
|
|
401
|
+
return new Proxy(Class, handler);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
static get method() {
|
|
405
|
+
return (obj, name, descr = Reflect.getOwnPropertyDescriptor(obj, name)) => {
|
|
406
|
+
descr.value = this.func(descr.value);
|
|
407
|
+
return descr;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
static get field() {
|
|
411
|
+
return (obj, name, descr = Reflect.getOwnPropertyDescriptor(obj, name)) => {
|
|
412
|
+
descr.get = descr.set = this.func(descr.get);
|
|
413
|
+
return descr;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
$.$mol_wrapper = $mol_wrapper;
|
|
418
|
+
})($ || ($ = {}));
|
|
419
|
+
|
|
420
|
+
;
|
|
421
|
+
"use strict";
|
|
422
|
+
var $;
|
|
423
|
+
(function ($) {
|
|
424
|
+
class $mol_memo extends $mol_wrapper {
|
|
425
|
+
static wrap(task) {
|
|
426
|
+
const store = new WeakMap();
|
|
427
|
+
const fun = function (next) {
|
|
428
|
+
if (next === undefined && store.has(this ?? fun))
|
|
429
|
+
return store.get(this ?? fun);
|
|
430
|
+
const val = task.call(this, next) ?? next;
|
|
431
|
+
store.set(this ?? fun, val);
|
|
432
|
+
return val;
|
|
433
|
+
};
|
|
434
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
435
|
+
return fun;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
$.$mol_memo = $mol_memo;
|
|
439
|
+
})($ || ($ = {}));
|
|
440
|
+
|
|
204
441
|
;
|
|
205
442
|
"use strict";
|
|
206
443
|
var $;
|
|
@@ -274,7 +511,32 @@ var $;
|
|
|
274
511
|
"use strict";
|
|
275
512
|
var $;
|
|
276
513
|
(function ($) {
|
|
277
|
-
|
|
514
|
+
class $mol_memo_key extends $mol_wrapper {
|
|
515
|
+
static wrap(task) {
|
|
516
|
+
const store = new WeakMap();
|
|
517
|
+
const fun = function (key, next) {
|
|
518
|
+
let store2 = store.get(this ?? fun);
|
|
519
|
+
if (!store2)
|
|
520
|
+
store.set(this ?? fun, store2 = new Map);
|
|
521
|
+
const key_str = $mol_key(key);
|
|
522
|
+
if (next === undefined && store2.has(key_str))
|
|
523
|
+
return store2.get(key_str);
|
|
524
|
+
const val = task.call(this, key, next) ?? next;
|
|
525
|
+
store2.set(key_str, val);
|
|
526
|
+
return val;
|
|
527
|
+
};
|
|
528
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
529
|
+
return fun;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
$.$mol_memo_key = $mol_memo_key;
|
|
533
|
+
})($ || ($ = {}));
|
|
534
|
+
|
|
535
|
+
;
|
|
536
|
+
"use strict";
|
|
537
|
+
var $;
|
|
538
|
+
(function ($) {
|
|
539
|
+
$.$mol_schema_pattern = $mol_memo_key.func(function $mol_schema_pattern(Pattern) {
|
|
278
540
|
return class $mol_schema_pattern_ extends $mol_schema_string {
|
|
279
541
|
static Pattern = Pattern;
|
|
280
542
|
static toString() {
|
|
@@ -292,15 +554,14 @@ var $;
|
|
|
292
554
|
}
|
|
293
555
|
static default = '';
|
|
294
556
|
};
|
|
295
|
-
}
|
|
296
|
-
$.$mol_schema_pattern = $mol_schema_pattern;
|
|
557
|
+
});
|
|
297
558
|
})($ || ($ = {}));
|
|
298
559
|
|
|
299
560
|
;
|
|
300
561
|
"use strict";
|
|
301
562
|
var $;
|
|
302
563
|
(function ($) {
|
|
303
|
-
function $mol_schema_instance(Class
|
|
564
|
+
$.$mol_schema_instance = $mol_memo_key.func(function $mol_schema_instance(Class) {
|
|
304
565
|
class $mol_schema_instance_ extends $mol_schema_any {
|
|
305
566
|
static Class = Class;
|
|
306
567
|
static toString() {
|
|
@@ -313,108 +574,129 @@ var $;
|
|
|
313
574
|
return value;
|
|
314
575
|
return $mol_fail(new TypeError('Wrong class', { cause: { value, schema: this } }));
|
|
315
576
|
}
|
|
316
|
-
static
|
|
577
|
+
static cast(value) {
|
|
578
|
+
return this.guard(value);
|
|
579
|
+
}
|
|
580
|
+
static default;
|
|
317
581
|
}
|
|
318
|
-
return ((Class[Symbol.hasInstance] === $mol_schema_any[Symbol.hasInstance])
|
|
582
|
+
return ((Class?.[Symbol.hasInstance] === $mol_schema_any[Symbol.hasInstance])
|
|
319
583
|
? Class
|
|
320
584
|
: $mol_schema_instance_);
|
|
321
|
-
}
|
|
322
|
-
$.$mol_schema_instance = $mol_schema_instance;
|
|
585
|
+
});
|
|
323
586
|
})($ || ($ = {}));
|
|
324
587
|
|
|
325
588
|
;
|
|
326
589
|
"use strict";
|
|
590
|
+
var $;
|
|
591
|
+
(function ($) {
|
|
592
|
+
function $mol_schema_lazy(Schema) {
|
|
593
|
+
// return $mol_delegate( $mol_schema_any, Schema )
|
|
594
|
+
return class $mol_schema_lazy_ extends $mol_schema_any {
|
|
595
|
+
static Schema = $mol_memo.func(Schema);
|
|
596
|
+
static guard(value) {
|
|
597
|
+
return this.Schema().guard(value);
|
|
598
|
+
}
|
|
599
|
+
static cast(value) {
|
|
600
|
+
return this.Schema().cast(value);
|
|
601
|
+
}
|
|
602
|
+
static get default() {
|
|
603
|
+
return this.Schema().default;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
$.$mol_schema_lazy = $mol_schema_lazy;
|
|
608
|
+
})($ || ($ = {}));
|
|
327
609
|
|
|
328
610
|
;
|
|
329
611
|
"use strict";
|
|
330
612
|
var $;
|
|
331
613
|
(function ($) {
|
|
332
|
-
function $
|
|
333
|
-
return class $
|
|
334
|
-
static
|
|
614
|
+
$.$mol_schema_some = $mol_memo_key.func(function $mol_schema_some(Variants) {
|
|
615
|
+
return class $mol_schema_some_ extends $mol_schema_any {
|
|
616
|
+
static Variants = Variants;
|
|
335
617
|
static toString() {
|
|
336
|
-
if (this !== $
|
|
618
|
+
if (this !== $mol_schema_some_)
|
|
337
619
|
return super.toString();
|
|
338
|
-
return '$
|
|
620
|
+
return '$mol_schema_some<' + $mol_key(Variants) + '>';
|
|
339
621
|
}
|
|
340
622
|
static guard(value) {
|
|
341
|
-
|
|
342
|
-
|
|
623
|
+
const errors = [];
|
|
624
|
+
for (const Variant of Variants) {
|
|
625
|
+
try {
|
|
626
|
+
return Variant.guard(value);
|
|
627
|
+
}
|
|
628
|
+
catch (error) {
|
|
629
|
+
errors.push(error);
|
|
630
|
+
}
|
|
343
631
|
}
|
|
344
|
-
return value;
|
|
632
|
+
return $mol_fail(new AggregateError(errors, 'Wrong variant', { cause: { value, schema: this } }));
|
|
345
633
|
}
|
|
346
634
|
static cast(value) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
635
|
+
try {
|
|
636
|
+
return this.guard(value);
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
return Variants[0].cast(value);
|
|
640
|
+
}
|
|
350
641
|
}
|
|
351
|
-
static default =
|
|
642
|
+
static default = Variants[0].default;
|
|
352
643
|
};
|
|
353
|
-
}
|
|
354
|
-
$.$mol_schema_every = $mol_schema_every;
|
|
644
|
+
});
|
|
355
645
|
})($ || ($ = {}));
|
|
356
646
|
|
|
357
647
|
;
|
|
358
648
|
"use strict";
|
|
359
649
|
var $;
|
|
360
650
|
(function ($) {
|
|
361
|
-
function $
|
|
362
|
-
return class $
|
|
363
|
-
static
|
|
364
|
-
static Max = Max;
|
|
651
|
+
$.$mol_schema_dict = $mol_memo_key.func(function $mol_schema_dict(Pair) {
|
|
652
|
+
return class $mol_schema_dict_ extends $mol_schema_any {
|
|
653
|
+
static Pair = Pair;
|
|
365
654
|
static toString() {
|
|
366
|
-
if (this !== $
|
|
655
|
+
if (this !== $mol_schema_dict_)
|
|
367
656
|
return super.toString();
|
|
368
|
-
return '$
|
|
657
|
+
return '$mol_schema_dict<' + $mol_key(Pair) + '>';
|
|
369
658
|
}
|
|
370
659
|
static guard(value) {
|
|
371
|
-
if (
|
|
372
|
-
return $mol_fail(new TypeError('
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
660
|
+
if (Object.getPrototypeOf(Object.getPrototypeOf(value))) {
|
|
661
|
+
return $mol_fail(new TypeError('Non dictionary', { cause: { value, schema: this } }));
|
|
662
|
+
}
|
|
663
|
+
for (const key in value) {
|
|
664
|
+
try {
|
|
665
|
+
Pair[0].guard(key);
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
return $mol_fail(new TypeError('Wrong key', { cause: { key, error, value, schema: this } }));
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
Pair[1].guard(value[key]);
|
|
672
|
+
}
|
|
673
|
+
catch (error) {
|
|
674
|
+
return $mol_fail(new TypeError('Wrong val', { cause: { key, error, value, schema: this } }));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
377
677
|
return value;
|
|
378
678
|
}
|
|
379
|
-
static cast(
|
|
380
|
-
if (
|
|
381
|
-
return
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
679
|
+
static cast(value) {
|
|
680
|
+
if (Object.getPrototypeOf(Object.getPrototypeOf(value)))
|
|
681
|
+
return this.default;
|
|
682
|
+
const res = {};
|
|
683
|
+
for (const key in value) {
|
|
684
|
+
if (!Pair[0].check(key))
|
|
685
|
+
continue;
|
|
686
|
+
res[key] = Pair[1].cast(value[key]);
|
|
687
|
+
}
|
|
688
|
+
return res;
|
|
385
689
|
}
|
|
386
|
-
static default =
|
|
690
|
+
static default = {};
|
|
387
691
|
};
|
|
388
|
-
}
|
|
389
|
-
$.$mol_schema_range = $mol_schema_range;
|
|
390
|
-
})($ || ($ = {}));
|
|
391
|
-
|
|
392
|
-
;
|
|
393
|
-
"use strict";
|
|
394
|
-
var $;
|
|
395
|
-
(function ($) {
|
|
396
|
-
class $mol_schema_positive extends $mol_schema_range(0, Number.POSITIVE_INFINITY) {
|
|
397
|
-
}
|
|
398
|
-
$.$mol_schema_positive = $mol_schema_positive;
|
|
399
|
-
})($ || ($ = {}));
|
|
400
|
-
|
|
401
|
-
;
|
|
402
|
-
"use strict";
|
|
403
|
-
var $;
|
|
404
|
-
(function ($) {
|
|
405
|
-
class $mol_schema_natural extends $mol_schema_every([
|
|
406
|
-
$mol_schema_integer,
|
|
407
|
-
$mol_schema_positive,
|
|
408
|
-
]) {
|
|
409
|
-
}
|
|
410
|
-
$.$mol_schema_natural = $mol_schema_natural;
|
|
692
|
+
});
|
|
411
693
|
})($ || ($ = {}));
|
|
412
694
|
|
|
413
695
|
;
|
|
414
696
|
"use strict";
|
|
415
697
|
var $;
|
|
416
698
|
(function ($) {
|
|
417
|
-
function $mol_schema_enum(Options) {
|
|
699
|
+
$.$mol_schema_enum = $mol_memo_key.func(function $mol_schema_enum(Options) {
|
|
418
700
|
return class $mol_schema_enum_ extends $mol_schema_any {
|
|
419
701
|
static Options = Options;
|
|
420
702
|
static toString() {
|
|
@@ -425,174 +707,188 @@ var $;
|
|
|
425
707
|
static guard(value) {
|
|
426
708
|
if (Options.some(Option => Object.is(Option, value)))
|
|
427
709
|
return value;
|
|
428
|
-
return $mol_fail(new TypeError('
|
|
710
|
+
return $mol_fail(new TypeError('Wrong option', { cause: { value, schema: this } }));
|
|
429
711
|
}
|
|
430
|
-
static cast(
|
|
431
|
-
if (this.check(
|
|
432
|
-
return
|
|
712
|
+
static cast(value) {
|
|
713
|
+
if (this.check(value))
|
|
714
|
+
return value;
|
|
433
715
|
return Options[0];
|
|
434
716
|
}
|
|
435
717
|
static default = Options[0];
|
|
436
718
|
};
|
|
437
|
-
}
|
|
438
|
-
$.$mol_schema_enum = $mol_schema_enum;
|
|
439
|
-
})($ || ($ = {}));
|
|
440
|
-
|
|
441
|
-
;
|
|
442
|
-
"use strict";
|
|
443
|
-
var $;
|
|
444
|
-
(function ($) {
|
|
445
|
-
class $mol_schema_negative extends $mol_schema_range(Number.NEGATIVE_INFINITY, 0) {
|
|
446
|
-
}
|
|
447
|
-
$.$mol_schema_negative = $mol_schema_negative;
|
|
719
|
+
});
|
|
448
720
|
})($ || ($ = {}));
|
|
449
721
|
|
|
450
722
|
;
|
|
451
723
|
"use strict";
|
|
452
724
|
var $;
|
|
453
725
|
(function ($) {
|
|
454
|
-
function $
|
|
455
|
-
return class $
|
|
456
|
-
static
|
|
726
|
+
$.$mol_schema_list = $mol_memo_key.func(function $mol_schema_list(Item) {
|
|
727
|
+
return class $mol_schema_list_ extends $mol_schema_any {
|
|
728
|
+
static Item = Item;
|
|
457
729
|
static toString() {
|
|
458
|
-
if (this !== $
|
|
730
|
+
if (this !== $mol_schema_list_)
|
|
459
731
|
return super.toString();
|
|
460
|
-
return '$
|
|
732
|
+
return '$mol_schema_list<' + $mol_key(Item) + '>';
|
|
461
733
|
}
|
|
462
734
|
static guard(value) {
|
|
463
|
-
|
|
464
|
-
|
|
735
|
+
if (!Array.isArray(value))
|
|
736
|
+
return $mol_fail(new TypeError('Non array', { cause: { value, schema: this } }));
|
|
737
|
+
for (const [index, item] of super.guard(value).entries()) {
|
|
465
738
|
try {
|
|
466
|
-
|
|
739
|
+
Item.guard(item);
|
|
467
740
|
}
|
|
468
741
|
catch (error) {
|
|
469
|
-
|
|
742
|
+
return $mol_fail(new TypeError('Wrong item', { cause: { index, error, value, schema: this } }));
|
|
470
743
|
}
|
|
471
744
|
}
|
|
472
|
-
return
|
|
745
|
+
return value;
|
|
473
746
|
}
|
|
474
747
|
static cast(value) {
|
|
475
|
-
|
|
476
|
-
return this.
|
|
477
|
-
|
|
478
|
-
catch (error) {
|
|
479
|
-
return Variants[0].cast(value);
|
|
480
|
-
}
|
|
748
|
+
if (!Array.isArray(value))
|
|
749
|
+
return this.default;
|
|
750
|
+
return value.map(item => Item.cast(item));
|
|
481
751
|
}
|
|
482
|
-
static default =
|
|
752
|
+
static default = [];
|
|
483
753
|
};
|
|
484
|
-
}
|
|
485
|
-
$.$mol_schema_some = $mol_schema_some;
|
|
754
|
+
});
|
|
486
755
|
})($ || ($ = {}));
|
|
487
756
|
|
|
488
757
|
;
|
|
489
758
|
"use strict";
|
|
490
759
|
var $;
|
|
491
760
|
(function ($) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return '$mol_schema_maybe<' + $mol_key(Some) + '>';
|
|
499
|
-
}
|
|
500
|
-
};
|
|
761
|
+
class $mol_schema_json extends $mol_schema_lazy(() => $mol_schema_some([
|
|
762
|
+
$mol_schema_dict([$mol_schema_string, $mol_schema_json]),
|
|
763
|
+
$mol_schema_enum([null]),
|
|
764
|
+
$mol_schema_boolean, $mol_schema_float, $mol_schema_string,
|
|
765
|
+
$mol_schema_list($mol_schema_json),
|
|
766
|
+
])) {
|
|
501
767
|
}
|
|
502
|
-
$.$
|
|
768
|
+
$.$mol_schema_json = $mol_schema_json;
|
|
503
769
|
})($ || ($ = {}));
|
|
504
770
|
|
|
771
|
+
;
|
|
772
|
+
"use strict";
|
|
773
|
+
|
|
505
774
|
;
|
|
506
775
|
"use strict";
|
|
507
776
|
var $;
|
|
508
777
|
(function ($) {
|
|
509
|
-
function $
|
|
510
|
-
return class $
|
|
511
|
-
static
|
|
778
|
+
$.$mol_schema_every = $mol_memo_key.func(function $mol_schema_every(Schemas) {
|
|
779
|
+
return class $mol_schema_every_ extends $mol_schema_any {
|
|
780
|
+
static Schemas = Schemas;
|
|
512
781
|
static toString() {
|
|
513
|
-
if (this !== $
|
|
782
|
+
if (this !== $mol_schema_every_)
|
|
514
783
|
return super.toString();
|
|
515
|
-
return '$
|
|
784
|
+
return '$mol_schema_every<' + $mol_key(Schemas) + '>';
|
|
516
785
|
}
|
|
517
786
|
static guard(value) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
for (const [index, item] of super.guard(value).entries()) {
|
|
521
|
-
try {
|
|
522
|
-
Item.guard(item);
|
|
523
|
-
}
|
|
524
|
-
catch (error) {
|
|
525
|
-
return $mol_fail(new TypeError('Wrong item', { cause: { index, error, value, schema: this } }));
|
|
526
|
-
}
|
|
787
|
+
for (const Schema of Schemas) {
|
|
788
|
+
Schema.guard(value);
|
|
527
789
|
}
|
|
528
790
|
return value;
|
|
529
791
|
}
|
|
530
792
|
static cast(value) {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return value
|
|
793
|
+
for (const Scheme of Schemas)
|
|
794
|
+
value = Scheme.cast(value);
|
|
795
|
+
return value;
|
|
534
796
|
}
|
|
535
|
-
static default =
|
|
797
|
+
static default = Schemas.find(Scheme => this.check(Scheme.default));
|
|
536
798
|
};
|
|
537
|
-
}
|
|
538
|
-
$.$mol_schema_list = $mol_schema_list;
|
|
799
|
+
});
|
|
539
800
|
})($ || ($ = {}));
|
|
540
801
|
|
|
541
802
|
;
|
|
542
803
|
"use strict";
|
|
543
804
|
var $;
|
|
544
805
|
(function ($) {
|
|
545
|
-
function $
|
|
546
|
-
return class $
|
|
547
|
-
static
|
|
548
|
-
static Val = Val;
|
|
806
|
+
$.$mol_schema_range = $mol_memo_key.func(function $mol_schema_range(Range) {
|
|
807
|
+
return class $mol_schema_range_ extends $mol_schema_any {
|
|
808
|
+
static Range = Range;
|
|
549
809
|
static toString() {
|
|
550
|
-
if (this !== $
|
|
810
|
+
if (this !== $mol_schema_range_)
|
|
551
811
|
return super.toString();
|
|
552
|
-
return '$
|
|
812
|
+
return '$mol_schema_range<' + $mol_key(Range) + '>';
|
|
553
813
|
}
|
|
554
814
|
static guard(value) {
|
|
555
|
-
if (
|
|
556
|
-
return $mol_fail(new TypeError('
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
catch (error) {
|
|
563
|
-
return $mol_fail(new TypeError('Wrong key', { cause: { key, error, value, schema: this } }));
|
|
564
|
-
}
|
|
565
|
-
try {
|
|
566
|
-
Val.guard(value[key]);
|
|
567
|
-
}
|
|
568
|
-
catch (error) {
|
|
569
|
-
return $mol_fail(new TypeError('Wrong val', { cause: { key, error, value, schema: this } }));
|
|
570
|
-
}
|
|
571
|
-
}
|
|
815
|
+
if (typeof value !== 'number' && typeof value !== 'bigint')
|
|
816
|
+
return $mol_fail(new TypeError('Uncomparable type', { cause: { value, schema: this } }));
|
|
817
|
+
if (!(value <= Range[1]))
|
|
818
|
+
return $mol_fail(new TypeError('Too large', { cause: { value, schema: this } }));
|
|
819
|
+
if (!(value >= Range[0]))
|
|
820
|
+
return $mol_fail(new TypeError('Too small', { cause: { value, schema: this } }));
|
|
572
821
|
return value;
|
|
573
822
|
}
|
|
574
823
|
static cast(value) {
|
|
575
|
-
if (
|
|
576
|
-
return
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
continue;
|
|
581
|
-
res[key] = Val.cast(value[key]);
|
|
582
|
-
}
|
|
583
|
-
return res;
|
|
824
|
+
if (value > Range[1])
|
|
825
|
+
return Range[1];
|
|
826
|
+
if (value >= Range[0])
|
|
827
|
+
return value;
|
|
828
|
+
return Range[0];
|
|
584
829
|
}
|
|
585
|
-
static default =
|
|
830
|
+
static default = Range[0];
|
|
586
831
|
};
|
|
832
|
+
});
|
|
833
|
+
})($ || ($ = {}));
|
|
834
|
+
|
|
835
|
+
;
|
|
836
|
+
"use strict";
|
|
837
|
+
var $;
|
|
838
|
+
(function ($) {
|
|
839
|
+
class $mol_schema_positive extends $mol_schema_range([0, Number.POSITIVE_INFINITY]) {
|
|
587
840
|
}
|
|
588
|
-
$.$
|
|
841
|
+
$.$mol_schema_positive = $mol_schema_positive;
|
|
842
|
+
})($ || ($ = {}));
|
|
843
|
+
|
|
844
|
+
;
|
|
845
|
+
"use strict";
|
|
846
|
+
var $;
|
|
847
|
+
(function ($) {
|
|
848
|
+
class $mol_schema_natural extends $mol_schema_every([
|
|
849
|
+
$mol_schema_integer,
|
|
850
|
+
$mol_schema_positive,
|
|
851
|
+
]) {
|
|
852
|
+
}
|
|
853
|
+
$.$mol_schema_natural = $mol_schema_natural;
|
|
854
|
+
})($ || ($ = {}));
|
|
855
|
+
|
|
856
|
+
;
|
|
857
|
+
"use strict";
|
|
858
|
+
var $;
|
|
859
|
+
(function ($) {
|
|
860
|
+
class $mol_schema_negative extends $mol_schema_range([Number.NEGATIVE_INFINITY, 0]) {
|
|
861
|
+
}
|
|
862
|
+
$.$mol_schema_negative = $mol_schema_negative;
|
|
589
863
|
})($ || ($ = {}));
|
|
590
864
|
|
|
591
865
|
;
|
|
592
866
|
"use strict";
|
|
593
867
|
var $;
|
|
594
868
|
(function ($) {
|
|
595
|
-
function $
|
|
869
|
+
$.$mol_schema_maybe = $mol_memo_key.func(function $mol_schema_maybe(Some) {
|
|
870
|
+
return class $mol_schema_maybe_ extends $mol_schema_any {
|
|
871
|
+
static Some = Some;
|
|
872
|
+
static toString() {
|
|
873
|
+
if (this !== $mol_schema_maybe_)
|
|
874
|
+
return super.toString();
|
|
875
|
+
return '$mol_schema_maybe<' + $mol_key(Some) + '>';
|
|
876
|
+
}
|
|
877
|
+
static guard(value) {
|
|
878
|
+
if (value == null)
|
|
879
|
+
return value;
|
|
880
|
+
return Some.guard(value);
|
|
881
|
+
}
|
|
882
|
+
static default = null;
|
|
883
|
+
};
|
|
884
|
+
});
|
|
885
|
+
})($ || ($ = {}));
|
|
886
|
+
|
|
887
|
+
;
|
|
888
|
+
"use strict";
|
|
889
|
+
var $;
|
|
890
|
+
(function ($) {
|
|
891
|
+
$.$mol_schema_record = $mol_memo_key.func(function $mol_schema_record(Fields) {
|
|
596
892
|
return class $mol_schema_record_ extends $mol_schema_any {
|
|
597
893
|
static Fields = Fields;
|
|
598
894
|
static toString() {
|
|
@@ -624,8 +920,7 @@ var $;
|
|
|
624
920
|
}
|
|
625
921
|
static default = Object.fromEntries(Object.entries(Fields).map(([field, Field]) => [field, Field.default]));
|
|
626
922
|
};
|
|
627
|
-
}
|
|
628
|
-
$.$mol_schema_record = $mol_schema_record;
|
|
923
|
+
});
|
|
629
924
|
})($ || ($ = {}));
|
|
630
925
|
|
|
631
926
|
;
|
|
@@ -660,17 +955,7 @@ var $;
|
|
|
660
955
|
return false;
|
|
661
956
|
}
|
|
662
957
|
}
|
|
663
|
-
$.$mol_promise_like = $mol_promise_like;
|
|
664
|
-
})($ || ($ = {}));
|
|
665
|
-
|
|
666
|
-
;
|
|
667
|
-
"use strict";
|
|
668
|
-
var $;
|
|
669
|
-
(function ($) {
|
|
670
|
-
function $mol_fail_hidden(error) {
|
|
671
|
-
throw error; /// Use 'Never Pause Here' breakpoint in DevTools or simply blackbox this script
|
|
672
|
-
}
|
|
673
|
-
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
958
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
674
959
|
})($ || ($ = {}));
|
|
675
960
|
|
|
676
961
|
;
|
|
@@ -938,79 +1223,6 @@ var $;
|
|
|
938
1223
|
});
|
|
939
1224
|
})($ || ($ = {}));
|
|
940
1225
|
|
|
941
|
-
;
|
|
942
|
-
"use strict";
|
|
943
|
-
var $;
|
|
944
|
-
(function ($) {
|
|
945
|
-
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
946
|
-
function $mol_ambient(overrides) {
|
|
947
|
-
return Object.setPrototypeOf(overrides, this || $);
|
|
948
|
-
}
|
|
949
|
-
$.$mol_ambient = $mol_ambient;
|
|
950
|
-
})($ || ($ = {}));
|
|
951
|
-
|
|
952
|
-
;
|
|
953
|
-
"use strict";
|
|
954
|
-
var $;
|
|
955
|
-
(function ($) {
|
|
956
|
-
$.$mol_owning_map = new WeakMap();
|
|
957
|
-
function $mol_owning_allow(having) {
|
|
958
|
-
try {
|
|
959
|
-
if (!having)
|
|
960
|
-
return false;
|
|
961
|
-
if (typeof having !== 'object' && typeof having !== 'function')
|
|
962
|
-
return false;
|
|
963
|
-
if (having instanceof $mol_delegate)
|
|
964
|
-
return false;
|
|
965
|
-
if (typeof having['destructor'] !== 'function')
|
|
966
|
-
return false;
|
|
967
|
-
return true;
|
|
968
|
-
}
|
|
969
|
-
catch {
|
|
970
|
-
return false;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
$.$mol_owning_allow = $mol_owning_allow;
|
|
974
|
-
function $mol_owning_get(having, Owner) {
|
|
975
|
-
if (!$mol_owning_allow(having))
|
|
976
|
-
return null;
|
|
977
|
-
while (true) {
|
|
978
|
-
const owner = $.$mol_owning_map.get(having);
|
|
979
|
-
if (!owner)
|
|
980
|
-
return owner;
|
|
981
|
-
if (!Owner)
|
|
982
|
-
return owner;
|
|
983
|
-
if (owner instanceof Owner)
|
|
984
|
-
return owner;
|
|
985
|
-
having = owner;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
$.$mol_owning_get = $mol_owning_get;
|
|
989
|
-
function $mol_owning_check(owner, having) {
|
|
990
|
-
if (!$mol_owning_allow(having))
|
|
991
|
-
return false;
|
|
992
|
-
if ($.$mol_owning_map.get(having) !== owner)
|
|
993
|
-
return false;
|
|
994
|
-
return true;
|
|
995
|
-
}
|
|
996
|
-
$.$mol_owning_check = $mol_owning_check;
|
|
997
|
-
function $mol_owning_catch(owner, having) {
|
|
998
|
-
if (!$mol_owning_allow(having))
|
|
999
|
-
return false;
|
|
1000
|
-
if ($.$mol_owning_map.get(having))
|
|
1001
|
-
return false;
|
|
1002
|
-
$.$mol_owning_map.set(having, owner);
|
|
1003
|
-
return true;
|
|
1004
|
-
}
|
|
1005
|
-
$.$mol_owning_catch = $mol_owning_catch;
|
|
1006
|
-
})($ || ($ = {}));
|
|
1007
|
-
|
|
1008
|
-
;
|
|
1009
|
-
"use strict";
|
|
1010
|
-
|
|
1011
|
-
;
|
|
1012
|
-
"use strict";
|
|
1013
|
-
|
|
1014
1226
|
;
|
|
1015
1227
|
"use strict";
|
|
1016
1228
|
|
|
@@ -1028,57 +1240,6 @@ var $;
|
|
|
1028
1240
|
|
|
1029
1241
|
;
|
|
1030
1242
|
"use strict";
|
|
1031
|
-
var $;
|
|
1032
|
-
(function ($) {
|
|
1033
|
-
if (!Symbol.dispose)
|
|
1034
|
-
Symbol.dispose = Symbol('Symbol.dispose');
|
|
1035
|
-
class $mol_object2 {
|
|
1036
|
-
static $ = $;
|
|
1037
|
-
[Symbol.toStringTag];
|
|
1038
|
-
[$mol_ambient_ref] = null;
|
|
1039
|
-
get $() {
|
|
1040
|
-
if (this[$mol_ambient_ref])
|
|
1041
|
-
return this[$mol_ambient_ref];
|
|
1042
|
-
const owner = $mol_owning_get(this);
|
|
1043
|
-
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
1044
|
-
}
|
|
1045
|
-
set $(next) {
|
|
1046
|
-
if (this[$mol_ambient_ref])
|
|
1047
|
-
$mol_fail_hidden(new Error('Context already defined'));
|
|
1048
|
-
this[$mol_ambient_ref] = next;
|
|
1049
|
-
}
|
|
1050
|
-
static create(init) {
|
|
1051
|
-
const obj = new this;
|
|
1052
|
-
if (init)
|
|
1053
|
-
init(obj);
|
|
1054
|
-
return obj;
|
|
1055
|
-
}
|
|
1056
|
-
static [Symbol.toPrimitive]() {
|
|
1057
|
-
return this.toString();
|
|
1058
|
-
}
|
|
1059
|
-
static toString() {
|
|
1060
|
-
return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
|
|
1061
|
-
}
|
|
1062
|
-
static toJSON() {
|
|
1063
|
-
return this.toString();
|
|
1064
|
-
}
|
|
1065
|
-
static [$mol_key_handle]() {
|
|
1066
|
-
return this.toString();
|
|
1067
|
-
}
|
|
1068
|
-
destructor() { }
|
|
1069
|
-
static destructor() { }
|
|
1070
|
-
[Symbol.dispose]() {
|
|
1071
|
-
this.destructor();
|
|
1072
|
-
}
|
|
1073
|
-
//[ Symbol.toPrimitive ]( hint: string ) {
|
|
1074
|
-
// return hint === 'number' ? this.valueOf() : this.toString()
|
|
1075
|
-
//}
|
|
1076
|
-
toString() {
|
|
1077
|
-
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
$.$mol_object2 = $mol_object2;
|
|
1081
|
-
})($ || ($ = {}));
|
|
1082
1243
|
|
|
1083
1244
|
;
|
|
1084
1245
|
"use strict";
|
|
@@ -1433,12 +1594,18 @@ var $;
|
|
|
1433
1594
|
'color': 'gray',
|
|
1434
1595
|
});
|
|
1435
1596
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1436
|
-
'margin-
|
|
1597
|
+
'margin-inline-start': '13px'
|
|
1437
1598
|
});
|
|
1438
1599
|
class Stack extends Array {
|
|
1439
1600
|
// [ Symbol.toPrimitive ]() {
|
|
1440
1601
|
// return this.toString()
|
|
1441
1602
|
// }
|
|
1603
|
+
match(...args) {
|
|
1604
|
+
return this.toString().match(...args);
|
|
1605
|
+
}
|
|
1606
|
+
split(...args) {
|
|
1607
|
+
return this.toString().split(...args);
|
|
1608
|
+
}
|
|
1442
1609
|
toString() {
|
|
1443
1610
|
return this.join('\n');
|
|
1444
1611
|
}
|
|
@@ -2276,14 +2443,14 @@ var $;
|
|
|
2276
2443
|
reuse: if (existen) {
|
|
2277
2444
|
if (!existen.temp)
|
|
2278
2445
|
break reuse;
|
|
2279
|
-
if (existen.task !== task) {
|
|
2280
|
-
cause = 'task';
|
|
2281
|
-
break reuse;
|
|
2282
|
-
}
|
|
2283
2446
|
if (existen.host !== host) {
|
|
2284
2447
|
cause = 'host';
|
|
2285
2448
|
break reuse;
|
|
2286
2449
|
}
|
|
2450
|
+
if (existen.task !== task) {
|
|
2451
|
+
cause = 'task';
|
|
2452
|
+
break reuse;
|
|
2453
|
+
}
|
|
2287
2454
|
if (!$mol_compare_deep(existen.args, args)) {
|
|
2288
2455
|
cause = 'args';
|
|
2289
2456
|
break reuse;
|
|
@@ -2901,7 +3068,7 @@ var $;
|
|
|
2901
3068
|
"use strict";
|
|
2902
3069
|
var $;
|
|
2903
3070
|
(function ($) {
|
|
2904
|
-
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: '
|
|
3071
|
+
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: `http://${process.env.DOMAIN || 'localhost'}/` }).window;
|
|
2905
3072
|
})($ || ($ = {}));
|
|
2906
3073
|
|
|
2907
3074
|
;
|
|
@@ -3919,6 +4086,149 @@ var $;
|
|
|
3919
4086
|
});
|
|
3920
4087
|
})($ || ($ = {}));
|
|
3921
4088
|
|
|
4089
|
+
;
|
|
4090
|
+
"use strict";
|
|
4091
|
+
var $;
|
|
4092
|
+
(function ($) {
|
|
4093
|
+
$mol_test({
|
|
4094
|
+
'run callback'() {
|
|
4095
|
+
class Plus1 extends $mol_wrapper {
|
|
4096
|
+
static wrap(task) {
|
|
4097
|
+
return function (...args) {
|
|
4098
|
+
return task.call(this, ...args) + 1;
|
|
4099
|
+
};
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
$mol_assert_equal(Plus1.run(() => 2), 3);
|
|
4103
|
+
},
|
|
4104
|
+
'wrap function'() {
|
|
4105
|
+
class Plus1 extends $mol_wrapper {
|
|
4106
|
+
static wrap(task) {
|
|
4107
|
+
return function (...args) {
|
|
4108
|
+
return task.call(this, ...args) + 1;
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
const obj = {
|
|
4113
|
+
level: 2,
|
|
4114
|
+
pow: Plus1.func(function (a) {
|
|
4115
|
+
return a ** this.level;
|
|
4116
|
+
})
|
|
4117
|
+
};
|
|
4118
|
+
$mol_assert_equal(obj.pow(2), 5);
|
|
4119
|
+
},
|
|
4120
|
+
'decorate field getter'() {
|
|
4121
|
+
class Plus1 extends $mol_wrapper {
|
|
4122
|
+
static last = 0;
|
|
4123
|
+
static wrap(task) {
|
|
4124
|
+
return function (...args) {
|
|
4125
|
+
return Plus1.last = (task.call(this, ...args) || 0) + 1;
|
|
4126
|
+
};
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
class Foo {
|
|
4130
|
+
static get two() {
|
|
4131
|
+
return 1;
|
|
4132
|
+
}
|
|
4133
|
+
static set two(next) { }
|
|
4134
|
+
}
|
|
4135
|
+
__decorate([
|
|
4136
|
+
Plus1.field
|
|
4137
|
+
], Foo, "two", null);
|
|
4138
|
+
$mol_assert_equal(Foo.two, 2);
|
|
4139
|
+
Foo.two = 3;
|
|
4140
|
+
$mol_assert_equal(Plus1.last, 2);
|
|
4141
|
+
$mol_assert_equal(Foo.two, 2);
|
|
4142
|
+
},
|
|
4143
|
+
'decorate instance method'() {
|
|
4144
|
+
class Plus1 extends $mol_wrapper {
|
|
4145
|
+
static wrap(task) {
|
|
4146
|
+
return function (...args) {
|
|
4147
|
+
return task.call(this, ...args) + 1;
|
|
4148
|
+
};
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
class Foo1 {
|
|
4152
|
+
level = 2;
|
|
4153
|
+
pow(a) {
|
|
4154
|
+
return a ** this.level;
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
4157
|
+
__decorate([
|
|
4158
|
+
Plus1.method
|
|
4159
|
+
], Foo1.prototype, "pow", null);
|
|
4160
|
+
const Foo2 = Foo1;
|
|
4161
|
+
const foo = new Foo2;
|
|
4162
|
+
$mol_assert_equal(foo.pow(2), 5);
|
|
4163
|
+
},
|
|
4164
|
+
'decorate static method'() {
|
|
4165
|
+
class Plus1 extends $mol_wrapper {
|
|
4166
|
+
static wrap(task) {
|
|
4167
|
+
return function (...args) {
|
|
4168
|
+
return task.call(this, ...args) + 1;
|
|
4169
|
+
};
|
|
4170
|
+
}
|
|
4171
|
+
}
|
|
4172
|
+
class Foo {
|
|
4173
|
+
static level = 2;
|
|
4174
|
+
static pow(a) {
|
|
4175
|
+
return a ** this.level;
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
__decorate([
|
|
4179
|
+
Plus1.method
|
|
4180
|
+
], Foo, "pow", null);
|
|
4181
|
+
$mol_assert_equal(Foo.pow(2), 5);
|
|
4182
|
+
},
|
|
4183
|
+
'decorate class'() {
|
|
4184
|
+
class BarInc extends $mol_wrapper {
|
|
4185
|
+
static wrap(task) {
|
|
4186
|
+
return function (...args) {
|
|
4187
|
+
const foo = task.call(this, ...args);
|
|
4188
|
+
foo.bar++;
|
|
4189
|
+
return foo;
|
|
4190
|
+
};
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
let Foo = class Foo {
|
|
4194
|
+
bar;
|
|
4195
|
+
constructor(bar) {
|
|
4196
|
+
this.bar = bar;
|
|
4197
|
+
}
|
|
4198
|
+
};
|
|
4199
|
+
Foo = __decorate([
|
|
4200
|
+
BarInc.class
|
|
4201
|
+
], Foo);
|
|
4202
|
+
$mol_assert_equal(new Foo(2).bar, 3);
|
|
4203
|
+
},
|
|
4204
|
+
});
|
|
4205
|
+
})($ || ($ = {}));
|
|
4206
|
+
|
|
4207
|
+
;
|
|
4208
|
+
"use strict";
|
|
4209
|
+
var $;
|
|
4210
|
+
(function ($) {
|
|
4211
|
+
$mol_test({
|
|
4212
|
+
'memoize field'() {
|
|
4213
|
+
class Foo {
|
|
4214
|
+
static one = 1;
|
|
4215
|
+
static get two() {
|
|
4216
|
+
return ++this.one;
|
|
4217
|
+
}
|
|
4218
|
+
static set two(next) { }
|
|
4219
|
+
}
|
|
4220
|
+
__decorate([
|
|
4221
|
+
$mol_memo.field
|
|
4222
|
+
], Foo, "two", null);
|
|
4223
|
+
$mol_assert_equal(Foo.two, 2);
|
|
4224
|
+
$mol_assert_equal(Foo.two, 2);
|
|
4225
|
+
Foo.two = 3;
|
|
4226
|
+
$mol_assert_equal(Foo.two, 3);
|
|
4227
|
+
$mol_assert_equal(Foo.two, 3);
|
|
4228
|
+
},
|
|
4229
|
+
});
|
|
4230
|
+
})($ || ($ = {}));
|
|
4231
|
+
|
|
3922
4232
|
;
|
|
3923
4233
|
"use strict";
|
|
3924
4234
|
/** @jsx $mol_jsx */
|
|
@@ -3994,6 +4304,10 @@ var $;
|
|
|
3994
4304
|
var $$;
|
|
3995
4305
|
(function ($$) {
|
|
3996
4306
|
$mol_test({
|
|
4307
|
+
"Cache of enum schema"($) {
|
|
4308
|
+
$mol_assert_equal($mol_schema_enum(['foo']), $mol_schema_enum(['foo']));
|
|
4309
|
+
$mol_assert_unique($mol_schema_enum(['foo']), $mol_schema_enum(['bar']));
|
|
4310
|
+
},
|
|
3997
4311
|
"Enum options"($) {
|
|
3998
4312
|
const Config = $mol_schema_enum([123, 'foo']);
|
|
3999
4313
|
$mol_assert_equal('$mol_schema_enum<[123,"foo"]>', Config + '', $mol_key(Config));
|
|
@@ -4006,7 +4320,7 @@ var $;
|
|
|
4006
4320
|
$mol_assert_equal(Config.cast('foo'), 'foo');
|
|
4007
4321
|
$mol_assert_equal(Config.cast('bar'), 123);
|
|
4008
4322
|
$mol_assert_equal(123, Config.guard(123));
|
|
4009
|
-
$mol_assert_fail(() => Config.guard(321), '
|
|
4323
|
+
$mol_assert_fail(() => Config.guard(321), 'Wrong option');
|
|
4010
4324
|
},
|
|
4011
4325
|
});
|
|
4012
4326
|
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
@@ -4061,6 +4375,10 @@ var $;
|
|
|
4061
4375
|
var $$;
|
|
4062
4376
|
(function ($$) {
|
|
4063
4377
|
$mol_test({
|
|
4378
|
+
"Cache of some schema"($) {
|
|
4379
|
+
$mol_assert_equal($mol_schema_some([$mol_schema_float]), $mol_schema_some([$mol_schema_float]));
|
|
4380
|
+
$mol_assert_unique($mol_schema_some([$mol_schema_float]), $mol_schema_some([$mol_schema_string]));
|
|
4381
|
+
},
|
|
4064
4382
|
"Some variant"($) {
|
|
4065
4383
|
const Config = $mol_schema_some([$mol_schema_float, $mol_schema_string]);
|
|
4066
4384
|
$mol_assert_equal('$mol_schema_some<[$mol_schema_float,$mol_schema_string]>', Config + '');
|
|
@@ -4071,7 +4389,7 @@ var $;
|
|
|
4071
4389
|
$mol_assert_equal('foo', Config.cast('foo'));
|
|
4072
4390
|
$mol_assert_equal(Number.NaN, Config.cast(true));
|
|
4073
4391
|
$mol_assert_equal(123, Config.guard(123));
|
|
4074
|
-
$mol_assert_fail(() => Config.guard(false), '
|
|
4392
|
+
$mol_assert_fail(() => Config.guard(false), 'Wrong variant');
|
|
4075
4393
|
},
|
|
4076
4394
|
});
|
|
4077
4395
|
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
@@ -4084,6 +4402,10 @@ var $;
|
|
|
4084
4402
|
var $$;
|
|
4085
4403
|
(function ($$) {
|
|
4086
4404
|
$mol_test({
|
|
4405
|
+
"Cache of maybe schema"($) {
|
|
4406
|
+
$mol_assert_equal($mol_schema_maybe($mol_schema_float), $mol_schema_maybe($mol_schema_float));
|
|
4407
|
+
$mol_assert_unique($mol_schema_maybe($mol_schema_float), $mol_schema_maybe($mol_schema_string));
|
|
4408
|
+
},
|
|
4087
4409
|
"Optional value"($) {
|
|
4088
4410
|
const Config = $mol_schema_maybe($mol_schema_string);
|
|
4089
4411
|
$mol_assert_equal('$mol_schema_maybe<$mol_schema_string>', Config + '');
|
|
@@ -4094,9 +4416,9 @@ var $;
|
|
|
4094
4416
|
$mol_assert_equal('foo', Config.cast('foo'));
|
|
4095
4417
|
$mol_assert_equal(undefined, Config.cast(undefined));
|
|
4096
4418
|
$mol_assert_equal(null, Config.cast(null));
|
|
4097
|
-
$mol_assert_equal(
|
|
4419
|
+
$mol_assert_equal(null, Config.cast(0));
|
|
4098
4420
|
$mol_assert_equal('foo', Config.guard('foo'));
|
|
4099
|
-
$mol_assert_fail(() => Config.guard(123), '
|
|
4421
|
+
$mol_assert_fail(() => Config.guard(123), 'Wrong type');
|
|
4100
4422
|
},
|
|
4101
4423
|
});
|
|
4102
4424
|
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
@@ -4139,8 +4461,12 @@ var $;
|
|
|
4139
4461
|
var $$;
|
|
4140
4462
|
(function ($$) {
|
|
4141
4463
|
$mol_test({
|
|
4464
|
+
"Cache of range schema"($) {
|
|
4465
|
+
$mol_assert_equal($mol_schema_range([0, 1]), $mol_schema_range([0, 1]));
|
|
4466
|
+
$mol_assert_unique($mol_schema_range([0, 1]), $mol_schema_range([0, 2]));
|
|
4467
|
+
},
|
|
4142
4468
|
"Float range schema"($) {
|
|
4143
|
-
const Range = $mol_schema_range(4, 8);
|
|
4469
|
+
const Range = $mol_schema_range([4, 8]);
|
|
4144
4470
|
$mol_assert_equal(true, Range.check(5.5));
|
|
4145
4471
|
$mol_assert_equal(true, Range.check(4));
|
|
4146
4472
|
$mol_assert_equal(true, Range.check(8));
|
|
@@ -4165,9 +4491,13 @@ var $;
|
|
|
4165
4491
|
var $$;
|
|
4166
4492
|
(function ($$) {
|
|
4167
4493
|
$mol_test({
|
|
4494
|
+
"Cache of every schema"($) {
|
|
4495
|
+
$mol_assert_equal($mol_schema_every([$mol_schema_float]), $mol_schema_every([$mol_schema_float]));
|
|
4496
|
+
$mol_assert_unique($mol_schema_every([$mol_schema_float]), $mol_schema_every([$mol_schema_string]));
|
|
4497
|
+
},
|
|
4168
4498
|
"Range intersection"($) {
|
|
4169
|
-
const Narrow = $mol_schema_every([$mol_schema_integer, $mol_schema_range(1, 8), $mol_schema_range(4, 10)]);
|
|
4170
|
-
$mol_assert_equal('$mol_schema_every<[$mol_schema_integer,$mol_schema_range<1,8>,$mol_schema_range<4,10>]>', Narrow + '');
|
|
4499
|
+
const Narrow = $mol_schema_every([$mol_schema_integer, $mol_schema_range([1, 8]), $mol_schema_range([4, 10])]);
|
|
4500
|
+
$mol_assert_equal('$mol_schema_every<[$mol_schema_integer,$mol_schema_range<[1,8]>,$mol_schema_range<[4,10]>]>', Narrow + '');
|
|
4171
4501
|
$mol_assert_equal(true, Narrow.check(6));
|
|
4172
4502
|
$mol_assert_equal(true, Narrow.check(4));
|
|
4173
4503
|
$mol_assert_equal(true, Narrow.check(8));
|
|
@@ -4193,6 +4523,10 @@ var $;
|
|
|
4193
4523
|
var $$;
|
|
4194
4524
|
(function ($$) {
|
|
4195
4525
|
$mol_test({
|
|
4526
|
+
"Cache of list schema"($) {
|
|
4527
|
+
$mol_assert_equal($mol_schema_list($mol_schema_float), $mol_schema_list($mol_schema_float));
|
|
4528
|
+
$mol_assert_unique($mol_schema_list($mol_schema_float), $mol_schema_list($mol_schema_string));
|
|
4529
|
+
},
|
|
4196
4530
|
"Array schema"($) {
|
|
4197
4531
|
const Vector = $mol_schema_list($mol_schema_float);
|
|
4198
4532
|
$mol_assert_equal('$mol_schema_list<$mol_schema_float>', Vector + '');
|
|
@@ -4217,6 +4551,10 @@ var $;
|
|
|
4217
4551
|
var $$;
|
|
4218
4552
|
(function ($$) {
|
|
4219
4553
|
$mol_test({
|
|
4554
|
+
"Cache of pattern schema"($) {
|
|
4555
|
+
$mol_assert_equal($mol_schema_pattern(/foo/), $mol_schema_pattern(/foo/));
|
|
4556
|
+
$mol_assert_unique($mol_schema_pattern(/foo/), $mol_schema_pattern(/bar/));
|
|
4557
|
+
},
|
|
4220
4558
|
"String pattern schema"($) {
|
|
4221
4559
|
const Email = $mol_schema_pattern(/^.*@.*$/);
|
|
4222
4560
|
$mol_assert_equal('$mol_schema_pattern</^.*@.*$/>', Email + '', $mol_key(Email));
|
|
@@ -4260,8 +4598,12 @@ var $;
|
|
|
4260
4598
|
var $;
|
|
4261
4599
|
(function ($_1) {
|
|
4262
4600
|
$mol_test({
|
|
4601
|
+
"Cache of dict schema"($) {
|
|
4602
|
+
$mol_assert_equal($mol_schema_dict([$mol_schema_string, $mol_schema_float]), $mol_schema_dict([$mol_schema_string, $mol_schema_float]));
|
|
4603
|
+
$mol_assert_unique($mol_schema_dict([$mol_schema_string, $mol_schema_float]), $mol_schema_dict([$mol_schema_string, $mol_schema_string]));
|
|
4604
|
+
},
|
|
4263
4605
|
"Dictionary schema"($) {
|
|
4264
|
-
const Flags = $mol_schema_dict($mol_schema_pattern(/^[a-z]+$/), $mol_schema_boolean);
|
|
4606
|
+
const Flags = $mol_schema_dict([$mol_schema_pattern(/^[a-z]+$/), $mol_schema_boolean]);
|
|
4265
4607
|
$mol_assert_equal(true, Flags.check({}));
|
|
4266
4608
|
$mol_assert_equal(true, Flags.check({ foo: false }));
|
|
4267
4609
|
$mol_assert_equal(false, Flags.check({ f00: false }));
|
|
@@ -4284,6 +4626,10 @@ var $;
|
|
|
4284
4626
|
var $$;
|
|
4285
4627
|
(function ($$) {
|
|
4286
4628
|
$mol_test({
|
|
4629
|
+
"Cache of record schema"($) {
|
|
4630
|
+
$mol_assert_equal($mol_schema_record({ foo: $mol_schema_float }), $mol_schema_record({ foo: $mol_schema_float }));
|
|
4631
|
+
$mol_assert_unique($mol_schema_record({ foo: $mol_schema_float }), $mol_schema_record({ foo: $mol_schema_string }));
|
|
4632
|
+
},
|
|
4287
4633
|
"Record schema"($) {
|
|
4288
4634
|
const User = $mol_schema_record({
|
|
4289
4635
|
name: $mol_schema_string,
|
|
@@ -4334,7 +4680,7 @@ var $;
|
|
|
4334
4680
|
});
|
|
4335
4681
|
$mol_assert_equal(true, User.check({ name: 'foo', age: 123 }));
|
|
4336
4682
|
$mol_assert_equal(true, User.check({ name: null }));
|
|
4337
|
-
$mol_assert_equal({ name: 'foo', age:
|
|
4683
|
+
$mol_assert_equal({ name: 'foo', age: null }, User.cast({ name: 'foo', age: false }));
|
|
4338
4684
|
$mol_assert_equal({ name: 'foo', age: undefined }, User.guard({ name: 'foo', age: undefined }));
|
|
4339
4685
|
$mol_assert_fail(() => User.guard({ name: 'foo', age: 'bar' }), 'Wrong field');
|
|
4340
4686
|
},
|
|
@@ -4369,6 +4715,10 @@ var $;
|
|
|
4369
4715
|
var $$;
|
|
4370
4716
|
(function ($$) {
|
|
4371
4717
|
$mol_test({
|
|
4718
|
+
"Cache of instance schema"($) {
|
|
4719
|
+
$mol_assert_equal($mol_schema_instance(Uint8Array), $mol_schema_instance(Uint8Array));
|
|
4720
|
+
$mol_assert_unique($mol_schema_instance(Uint8Array), $mol_schema_instance(Int8Array));
|
|
4721
|
+
},
|
|
4372
4722
|
"Class instance schema"($) {
|
|
4373
4723
|
const Blob = $mol_schema_instance(Uint8Array);
|
|
4374
4724
|
$mol_assert_equal('$mol_schema_instance<Uint8Array>', Blob + '', $mol_key(Blob));
|
|
@@ -4376,7 +4726,7 @@ var $;
|
|
|
4376
4726
|
$mol_assert_equal(false, Blob.check(new Int8Array));
|
|
4377
4727
|
$mol_assert_equal(false, Blob.check(null));
|
|
4378
4728
|
$mol_assert_equal(new Uint8Array([0, 1]), Blob.cast(new Uint8Array([0, 1])));
|
|
4379
|
-
$
|
|
4729
|
+
$mol_assert_fail(() => Blob.cast(new Int8Array), 'Wrong class');
|
|
4380
4730
|
$mol_assert_equal(new Uint8Array, Blob.guard(new Uint8Array));
|
|
4381
4731
|
$mol_assert_fail(() => Blob.guard(new Int8Array), 'Wrong class');
|
|
4382
4732
|
},
|
|
@@ -4401,43 +4751,50 @@ var $;
|
|
|
4401
4751
|
;
|
|
4402
4752
|
"use strict";
|
|
4403
4753
|
var $;
|
|
4404
|
-
(function ($) {
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
*/
|
|
4411
|
-
function $mol_delegate(proto, target) {
|
|
4412
|
-
const proxy = new Proxy(proto, {
|
|
4413
|
-
get: (_, field) => {
|
|
4414
|
-
const obj = target();
|
|
4415
|
-
let val = Reflect.get(obj, field);
|
|
4416
|
-
if (typeof val === 'function') {
|
|
4417
|
-
val = val.bind(obj);
|
|
4754
|
+
(function ($_1) {
|
|
4755
|
+
var $$;
|
|
4756
|
+
(function ($$) {
|
|
4757
|
+
$mol_test({
|
|
4758
|
+
"Integers as recursive Sets"($) {
|
|
4759
|
+
class Schema extends $mol_schema_lazy(() => $mol_schema_list(Schema)) {
|
|
4418
4760
|
}
|
|
4419
|
-
|
|
4761
|
+
$mol_assert_equal(Schema.default, []);
|
|
4762
|
+
$mol_assert_equal(Schema.check([]), true);
|
|
4763
|
+
$mol_assert_equal(Schema.check(''), false);
|
|
4764
|
+
$mol_assert_equal(Schema.guard([]), []);
|
|
4765
|
+
$mol_assert_fail(() => Schema.guard(''), 'Non array');
|
|
4766
|
+
$mol_assert_equal(Schema.cast([]), []);
|
|
4767
|
+
$mol_assert_equal(Schema.cast(''), []);
|
|
4420
4768
|
},
|
|
4421
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
4422
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
4423
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
4424
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
4425
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
4426
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
4427
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
4428
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
4429
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
4430
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
4431
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
4432
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
4433
4769
|
});
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4770
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
4771
|
+
})($ || ($ = {}));
|
|
4772
|
+
|
|
4773
|
+
;
|
|
4774
|
+
"use strict";
|
|
4775
|
+
var $;
|
|
4776
|
+
(function ($_1) {
|
|
4777
|
+
var $$;
|
|
4778
|
+
(function ($$) {
|
|
4779
|
+
$mol_test({
|
|
4780
|
+
"JSON schema"($) {
|
|
4781
|
+
$mol_assert_equal('$mol_schema_json', $mol_schema_json + '', $mol_key($mol_schema_json));
|
|
4782
|
+
$mol_assert_equal(true, $mol_schema_json.check(null));
|
|
4783
|
+
$mol_assert_equal(true, $mol_schema_json.check(0));
|
|
4784
|
+
$mol_assert_equal(true, $mol_schema_json.check(false));
|
|
4785
|
+
$mol_assert_equal(true, $mol_schema_json.check(''));
|
|
4786
|
+
$mol_assert_equal(true, $mol_schema_json.check([]));
|
|
4787
|
+
$mol_assert_equal(true, $mol_schema_json.check({}));
|
|
4788
|
+
$mol_assert_equal(false, $mol_schema_json.check(undefined));
|
|
4789
|
+
$mol_assert_equal(false, $mol_schema_json.check(new Date));
|
|
4790
|
+
$mol_assert_equal(false, $mol_schema_json.check({ __proto__: {} }));
|
|
4791
|
+
$mol_assert_equal({}, $mol_schema_json.cast(new Date));
|
|
4792
|
+
$mol_assert_equal({ foo: 777, bar: {} }, $mol_schema_json.cast({ foo: 777, bar: new Date }));
|
|
4793
|
+
$mol_assert_equal({ foo: [null, 0, false, ''] }, $mol_schema_json.guard({ foo: [null, 0, false, ''] }));
|
|
4794
|
+
$mol_assert_fail(() => $mol_schema_json.guard({ foo: [new Date] }), 'Wrong variant');
|
|
4795
|
+
},
|
|
4796
|
+
});
|
|
4797
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
4441
4798
|
})($ || ($ = {}));
|
|
4442
4799
|
|
|
4443
4800
|
;
|
|
@@ -5371,7 +5728,7 @@ var $;
|
|
|
5371
5728
|
} + '', class Some extends $mol_schema_maybe($mol_schema_float) {
|
|
5372
5729
|
} + '', class Some extends $mol_schema_every([$mol_schema_float]) {
|
|
5373
5730
|
} + '', class Some extends $mol_schema_list($mol_schema_float) {
|
|
5374
|
-
} + '', class Some extends $mol_schema_dict($mol_schema_string, $mol_schema_string) {
|
|
5731
|
+
} + '', class Some extends $mol_schema_dict([$mol_schema_string, $mol_schema_string]) {
|
|
5375
5732
|
} + '', class Some extends $mol_schema_record({ name: $mol_schema_string }) {
|
|
5376
5733
|
} + '', class Some extends $mol_schema_partial({ name: $mol_schema_string }) {
|
|
5377
5734
|
} + '');
|