mol_data_all 1.1.554 → 1.1.555
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 -0
- package/node.d.ts +7 -0
- package/node.deps.json +1 -1
- package/node.esm.js +15 -1
- package/node.esm.js.map +1 -1
- package/node.js +15 -1
- package/node.js.map +1 -1
- package/node.test.js +52 -1
- package/node.test.js.map +1 -1
- package/package.json +2 -1
- package/web.d.ts +7 -0
- package/web.deps.json +1 -1
- package/web.esm.js +15 -1
- package/web.esm.js.map +1 -1
- package/web.js +15 -1
- package/web.js.map +1 -1
- package/web.test.js +37 -0
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -282,7 +282,7 @@ var $;
|
|
|
282
282
|
return $mol_data_setup((val) => {
|
|
283
283
|
if ($mol_compare_deep(val, ref))
|
|
284
284
|
return ref;
|
|
285
|
-
return $mol_fail(new $mol_data_error(`${val} is not ${ref}`));
|
|
285
|
+
return $mol_fail(new $mol_data_error(`${JSON.stringify(val)} is not ${JSON.stringify(ref)}`));
|
|
286
286
|
}, ref);
|
|
287
287
|
}
|
|
288
288
|
$.$mol_data_const = $mol_data_const;
|
|
@@ -383,6 +383,20 @@ var $;
|
|
|
383
383
|
;
|
|
384
384
|
"use strict";
|
|
385
385
|
var $;
|
|
386
|
+
(function ($) {
|
|
387
|
+
function $mol_data_range(from, to) {
|
|
388
|
+
return $mol_data_setup((val) => {
|
|
389
|
+
if (val > from && val < to)
|
|
390
|
+
return val;
|
|
391
|
+
return $mol_fail(new $mol_data_error(`${val} is out range (${from},${to})`));
|
|
392
|
+
}, [from, to]);
|
|
393
|
+
}
|
|
394
|
+
$.$mol_data_range = $mol_data_range;
|
|
395
|
+
})($ || ($ = {}));
|
|
396
|
+
//mol/data/range/range.ts
|
|
397
|
+
;
|
|
398
|
+
"use strict";
|
|
399
|
+
var $;
|
|
386
400
|
(function ($) {
|
|
387
401
|
function $mol_data_nominal(config) {
|
|
388
402
|
const nominal = Object.keys(config)[0];
|
|
@@ -2172,6 +2186,10 @@ var $;
|
|
|
2172
2186
|
const Five = $mol_data_const(5);
|
|
2173
2187
|
$mol_assert_fail(() => Five(6), '6 is not 5');
|
|
2174
2188
|
},
|
|
2189
|
+
'is different object'() {
|
|
2190
|
+
const Tags = $mol_data_const({ tags: ['deep', 'equals'] });
|
|
2191
|
+
$mol_assert_fail(() => Tags({ tags: ['shallow', 'equals'] }), `{"tags":["shallow","equals"]} is not {"tags":["deep","equals"]}`);
|
|
2192
|
+
},
|
|
2175
2193
|
});
|
|
2176
2194
|
})($ || ($ = {}));
|
|
2177
2195
|
//mol/data/const/const.test.ts
|
|
@@ -2356,6 +2374,39 @@ var $;
|
|
|
2356
2374
|
;
|
|
2357
2375
|
"use strict";
|
|
2358
2376
|
var $;
|
|
2377
|
+
(function ($) {
|
|
2378
|
+
$mol_test({
|
|
2379
|
+
'Closed number range'() {
|
|
2380
|
+
const Pos = $mol_data_range(0, 1);
|
|
2381
|
+
Pos(Number.EPSILON);
|
|
2382
|
+
$mol_assert_fail(() => Pos(1), '1 is out range (0,1)');
|
|
2383
|
+
$mol_assert_fail(() => Pos(0), '0 is out range (0,1)');
|
|
2384
|
+
$mol_assert_fail(() => Pos(Number.POSITIVE_INFINITY), 'Infinity is out range (0,1)');
|
|
2385
|
+
$mol_assert_fail(() => Pos(Number.NEGATIVE_INFINITY), '-Infinity is out range (0,1)');
|
|
2386
|
+
$mol_assert_fail(() => Pos(NaN), 'NaN is out range (0,1)');
|
|
2387
|
+
},
|
|
2388
|
+
'Open number range'() {
|
|
2389
|
+
const Pos = $mol_data_range(0, Number.POSITIVE_INFINITY);
|
|
2390
|
+
Pos(Number.EPSILON);
|
|
2391
|
+
Pos(Number.MAX_VALUE);
|
|
2392
|
+
$mol_assert_fail(() => Pos(0), '0 is out range (0,Infinity)');
|
|
2393
|
+
$mol_assert_fail(() => Pos(Number.POSITIVE_INFINITY), 'Infinity is out range (0,Infinity)');
|
|
2394
|
+
$mol_assert_fail(() => Pos(Number.NEGATIVE_INFINITY), '-Infinity is out range (0,Infinity)');
|
|
2395
|
+
$mol_assert_fail(() => Pos(NaN), 'NaN is out range (0,Infinity)');
|
|
2396
|
+
},
|
|
2397
|
+
'String range'() {
|
|
2398
|
+
const Code = $mol_data_range('A', 'B');
|
|
2399
|
+
Code('Aa');
|
|
2400
|
+
Code('AZ');
|
|
2401
|
+
$mol_assert_fail(() => Code('A'), 'A is out range (A,B)');
|
|
2402
|
+
$mol_assert_fail(() => Code('B'), 'B is out range (A,B)');
|
|
2403
|
+
},
|
|
2404
|
+
});
|
|
2405
|
+
})($ || ($ = {}));
|
|
2406
|
+
//mol/data/range/range.test.ts
|
|
2407
|
+
;
|
|
2408
|
+
"use strict";
|
|
2409
|
+
var $;
|
|
2359
2410
|
(function ($) {
|
|
2360
2411
|
$mol_test({
|
|
2361
2412
|
'Nominal typing'() {
|