mol_time_all 1.1.499 → 1.1.500

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/node.test.js CHANGED
@@ -1027,21 +1027,27 @@ var $;
1027
1027
  //mol/dom/render/children/children.ts
1028
1028
  ;
1029
1029
  "use strict";
1030
- //mol/type/partial/deep/deep.ts
1030
+ //mol/type/error/error.ts
1031
1031
  ;
1032
1032
  "use strict";
1033
- //mol/type/error/error.ts
1033
+ //mol/type/assert/assert.test.ts
1034
1034
  ;
1035
1035
  "use strict";
1036
1036
  //mol/type/assert/assert.ts
1037
1037
  ;
1038
1038
  "use strict";
1039
- //mol/type/assert/assert.test.ts
1039
+ //mol/type/equals/equals.test.ts
1040
+ ;
1041
+ "use strict";
1042
+ //mol/type/equals/equals.ts
1040
1043
  ;
1041
1044
  "use strict";
1042
1045
  //mol/type/partial/deep/deep.test.ts
1043
1046
  ;
1044
1047
  "use strict";
1048
+ //mol/type/partial/deep/deep.ts
1049
+ ;
1050
+ "use strict";
1045
1051
  var $;
1046
1052
  (function ($) {
1047
1053
  $mol_test({
@@ -1486,6 +1492,38 @@ var $;
1486
1492
  ;
1487
1493
  "use strict";
1488
1494
  var $;
1495
+ (function ($) {
1496
+ $mol_test({
1497
+ 'must be false'() {
1498
+ $mol_assert_not(0);
1499
+ },
1500
+ 'must be true'() {
1501
+ $mol_assert_ok(1);
1502
+ },
1503
+ 'two must be equal'() {
1504
+ $mol_assert_equal(2, 2);
1505
+ },
1506
+ 'three must be equal'() {
1507
+ $mol_assert_equal(2, 2, 2);
1508
+ },
1509
+ 'two must be unique'() {
1510
+ $mol_assert_unique([3], [3]);
1511
+ },
1512
+ 'three must be unique'() {
1513
+ $mol_assert_unique([3], [3], [3]);
1514
+ },
1515
+ 'two must be alike'() {
1516
+ $mol_assert_like([3], [3]);
1517
+ },
1518
+ 'three must be alike'() {
1519
+ $mol_assert_like([3], [3], [3]);
1520
+ },
1521
+ });
1522
+ })($ || ($ = {}));
1523
+ //mol/assert/assert.test.ts
1524
+ ;
1525
+ "use strict";
1526
+ var $;
1489
1527
  (function ($) {
1490
1528
  function $mol_assert_ok(value) {
1491
1529
  if (value)
@@ -1582,33 +1620,25 @@ var $;
1582
1620
  var $;
1583
1621
  (function ($) {
1584
1622
  $mol_test({
1585
- 'must be false'() {
1586
- $mol_assert_not(0);
1587
- },
1588
- 'must be true'() {
1589
- $mol_assert_ok(1);
1590
- },
1591
- 'two must be equal'() {
1592
- $mol_assert_equal(2, 2);
1593
- },
1594
- 'three must be equal'() {
1595
- $mol_assert_equal(2, 2, 2);
1596
- },
1597
- 'two must be unique'() {
1598
- $mol_assert_unique([3], [3]);
1599
- },
1600
- 'three must be unique'() {
1601
- $mol_assert_unique([3], [3], [3]);
1623
+ 'parse and serial'() {
1624
+ $mol_assert_equal(new $mol_time_duration('P42.1Y').toString(), 'P42.1YT');
1625
+ $mol_assert_equal(new $mol_time_duration('P42.1M').toString(), 'P42.1MT');
1626
+ $mol_assert_equal(new $mol_time_duration('P42.1D').toString(), 'P42.1DT');
1627
+ $mol_assert_equal(new $mol_time_duration('PT42.1h').toString(), 'PT42.1H');
1628
+ $mol_assert_equal(new $mol_time_duration('PT42.1m').toString(), 'PT42.1M');
1629
+ $mol_assert_equal(new $mol_time_duration('PT42.1s').toString(), 'PT42.1S');
1630
+ $mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6.7s').toString(), 'P1Y2M3DT4H5M6.7S');
1602
1631
  },
1603
- 'two must be alike'() {
1604
- $mol_assert_like([3], [3]);
1632
+ 'format typed'() {
1633
+ $mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
1605
1634
  },
1606
- 'three must be alike'() {
1607
- $mol_assert_like([3], [3], [3]);
1635
+ 'comparison'() {
1636
+ const iso = 'P1Y1M1DT1h1m1s';
1637
+ $mol_assert_like(new $mol_time_duration(iso), new $mol_time_duration(iso));
1608
1638
  },
1609
1639
  });
1610
1640
  })($ || ($ = {}));
1611
- //mol/assert/assert.test.ts
1641
+ //mol/time/duration/duration.test.ts
1612
1642
  ;
1613
1643
  "use strict";
1614
1644
  var $;
@@ -1623,6 +1653,106 @@ var $;
1623
1653
  ;
1624
1654
  "use strict";
1625
1655
  var $;
1656
+ (function ($) {
1657
+ $mol_test({
1658
+ 'get'() {
1659
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
1660
+ $mol_assert_equal(proxy.foo, 777);
1661
+ },
1662
+ 'has'() {
1663
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
1664
+ $mol_assert_equal('foo' in proxy, true);
1665
+ },
1666
+ 'set'() {
1667
+ const target = { foo: 777 };
1668
+ const proxy = $mol_delegate({}, () => target);
1669
+ proxy.foo = 123;
1670
+ $mol_assert_equal(target.foo, 123);
1671
+ },
1672
+ 'getOwnPropertyDescriptor'() {
1673
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
1674
+ $mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
1675
+ value: 777,
1676
+ writable: true,
1677
+ enumerable: true,
1678
+ configurable: true,
1679
+ });
1680
+ },
1681
+ 'ownKeys'() {
1682
+ const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
1683
+ $mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
1684
+ },
1685
+ 'getPrototypeOf'() {
1686
+ class Foo {
1687
+ }
1688
+ const proxy = $mol_delegate({}, () => new Foo);
1689
+ $mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
1690
+ },
1691
+ 'setPrototypeOf'() {
1692
+ class Foo {
1693
+ }
1694
+ const target = {};
1695
+ const proxy = $mol_delegate({}, () => target);
1696
+ Object.setPrototypeOf(proxy, Foo.prototype);
1697
+ $mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
1698
+ },
1699
+ 'instanceof'() {
1700
+ class Foo {
1701
+ }
1702
+ const proxy = $mol_delegate({}, () => new Foo);
1703
+ $mol_assert_ok(proxy instanceof Foo);
1704
+ $mol_assert_ok(proxy instanceof $mol_delegate);
1705
+ },
1706
+ 'autobind'() {
1707
+ class Foo {
1708
+ }
1709
+ const proxy = $mol_delegate({}, () => new Foo);
1710
+ $mol_assert_ok(proxy instanceof Foo);
1711
+ $mol_assert_ok(proxy instanceof $mol_delegate);
1712
+ },
1713
+ });
1714
+ })($ || ($ = {}));
1715
+ //mol/delegate/delegate.test.ts
1716
+ ;
1717
+ "use strict";
1718
+ var $;
1719
+ (function ($) {
1720
+ const instances = new WeakSet();
1721
+ function $mol_delegate(proto, target) {
1722
+ const proxy = new Proxy(proto, {
1723
+ get: (_, field) => {
1724
+ const obj = target();
1725
+ let val = Reflect.get(obj, field);
1726
+ if (typeof val === 'function') {
1727
+ val = val.bind(obj);
1728
+ }
1729
+ return val;
1730
+ },
1731
+ has: (_, field) => Reflect.has(target(), field),
1732
+ set: (_, field, value) => Reflect.set(target(), field, value),
1733
+ getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
1734
+ ownKeys: () => Reflect.ownKeys(target()),
1735
+ getPrototypeOf: () => Reflect.getPrototypeOf(target()),
1736
+ setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
1737
+ isExtensible: () => Reflect.isExtensible(target()),
1738
+ preventExtensions: () => Reflect.preventExtensions(target()),
1739
+ apply: (_, self, args) => Reflect.apply(target(), self, args),
1740
+ construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
1741
+ defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
1742
+ deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
1743
+ });
1744
+ instances.add(proxy);
1745
+ return proxy;
1746
+ }
1747
+ $.$mol_delegate = $mol_delegate;
1748
+ Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
1749
+ value: (obj) => instances.has(obj),
1750
+ });
1751
+ })($ || ($ = {}));
1752
+ //mol/delegate/delegate.ts
1753
+ ;
1754
+ "use strict";
1755
+ var $;
1626
1756
  (function ($) {
1627
1757
  $.$mol_owning_map = new WeakMap();
1628
1758
  function $mol_owning_allow(having) {
@@ -1678,16 +1808,10 @@ var $;
1678
1808
  //mol/owning/owning.ts
1679
1809
  ;
1680
1810
  "use strict";
1681
- //mol/type/writable/writable.ts
1682
- ;
1683
- "use strict";
1684
- //mol/type/equals/equals.ts
1685
- ;
1686
- "use strict";
1687
- //mol/type/equals/equals.test.ts
1811
+ //mol/type/writable/writable.test.ts
1688
1812
  ;
1689
1813
  "use strict";
1690
- //mol/type/writable/writable.test.ts
1814
+ //mol/type/writable/writable.ts
1691
1815
  ;
1692
1816
  "use strict";
1693
1817
  var $;
@@ -1734,6 +1858,66 @@ var $;
1734
1858
  ;
1735
1859
  "use strict";
1736
1860
  var $;
1861
+ (function ($_1) {
1862
+ $mol_test({
1863
+ 'tree parsing'() {
1864
+ $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
1865
+ $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
1866
+ $mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
1867
+ $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
1868
+ $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
1869
+ $mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
1870
+ $mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
1871
+ $mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
1872
+ },
1873
+ 'inserting'() {
1874
+ $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
1875
+ $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
1876
+ $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
1877
+ $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
1878
+ $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
1879
+ $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
1880
+ },
1881
+ 'fromJSON'() {
1882
+ $mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
1883
+ $mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
1884
+ $mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
1885
+ $mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
1886
+ $mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
1887
+ },
1888
+ 'toJSON'() {
1889
+ $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
1890
+ $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
1891
+ $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
1892
+ $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
1893
+ $mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
1894
+ },
1895
+ 'hack'() {
1896
+ const res = $mol_tree.fromString(`foo bar xxx`).hack({
1897
+ '': (tree, context) => [tree.hack(context)],
1898
+ 'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
1899
+ });
1900
+ $mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
1901
+ },
1902
+ 'errors handling'($) {
1903
+ const errors = [];
1904
+ class Tree extends $mol_tree {
1905
+ static $ = $.$mol_ambient({
1906
+ $mol_fail: error => errors.push(error.message)
1907
+ });
1908
+ }
1909
+ Tree.fromString(`
1910
+ \t \tfoo
1911
+ bar \\data
1912
+ `, 'test');
1913
+ $mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
1914
+ },
1915
+ });
1916
+ })($ || ($ = {}));
1917
+ //mol/tree/tree.test.ts
1918
+ ;
1919
+ "use strict";
1920
+ var $;
1737
1921
  (function ($) {
1738
1922
  $.$mol_tree_convert = Symbol('$mol_tree_convert');
1739
1923
  class $mol_tree extends $mol_object2 {
@@ -2064,163 +2248,17 @@ var $;
2064
2248
  ;
2065
2249
  "use strict";
2066
2250
  var $;
2067
- (function ($) {
2068
- const instances = new WeakSet();
2069
- function $mol_delegate(proto, target) {
2070
- const proxy = new Proxy(proto, {
2071
- get: (_, field) => {
2072
- const obj = target();
2073
- let val = Reflect.get(obj, field);
2074
- if (typeof val === 'function') {
2075
- val = val.bind(obj);
2076
- }
2077
- return val;
2078
- },
2079
- has: (_, field) => Reflect.has(target(), field),
2080
- set: (_, field, value) => Reflect.set(target(), field, value),
2081
- getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
2082
- ownKeys: () => Reflect.ownKeys(target()),
2083
- getPrototypeOf: () => Reflect.getPrototypeOf(target()),
2084
- setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
2085
- isExtensible: () => Reflect.isExtensible(target()),
2086
- preventExtensions: () => Reflect.preventExtensions(target()),
2087
- apply: (_, self, args) => Reflect.apply(target(), self, args),
2088
- construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
2089
- defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
2090
- deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
2091
- });
2092
- instances.add(proxy);
2093
- return proxy;
2094
- }
2095
- $.$mol_delegate = $mol_delegate;
2096
- Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
2097
- value: (obj) => instances.has(obj),
2098
- });
2099
- })($ || ($ = {}));
2100
- //mol/delegate/delegate.ts
2101
- ;
2102
- "use strict";
2103
- var $;
2104
- (function ($) {
2105
- $mol_test({
2106
- 'get'() {
2107
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
2108
- $mol_assert_equal(proxy.foo, 777);
2109
- },
2110
- 'has'() {
2111
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
2112
- $mol_assert_equal('foo' in proxy, true);
2113
- },
2114
- 'set'() {
2115
- const target = { foo: 777 };
2116
- const proxy = $mol_delegate({}, () => target);
2117
- proxy.foo = 123;
2118
- $mol_assert_equal(target.foo, 123);
2119
- },
2120
- 'getOwnPropertyDescriptor'() {
2121
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
2122
- $mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
2123
- value: 777,
2124
- writable: true,
2125
- enumerable: true,
2126
- configurable: true,
2127
- });
2128
- },
2129
- 'ownKeys'() {
2130
- const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
2131
- $mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
2132
- },
2133
- 'getPrototypeOf'() {
2134
- class Foo {
2135
- }
2136
- const proxy = $mol_delegate({}, () => new Foo);
2137
- $mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
2138
- },
2139
- 'setPrototypeOf'() {
2140
- class Foo {
2141
- }
2142
- const target = {};
2143
- const proxy = $mol_delegate({}, () => target);
2144
- Object.setPrototypeOf(proxy, Foo.prototype);
2145
- $mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
2146
- },
2147
- 'instanceof'() {
2148
- class Foo {
2149
- }
2150
- const proxy = $mol_delegate({}, () => new Foo);
2151
- $mol_assert_ok(proxy instanceof Foo);
2152
- $mol_assert_ok(proxy instanceof $mol_delegate);
2153
- },
2154
- 'autobind'() {
2155
- class Foo {
2156
- }
2157
- const proxy = $mol_delegate({}, () => new Foo);
2158
- $mol_assert_ok(proxy instanceof Foo);
2159
- $mol_assert_ok(proxy instanceof $mol_delegate);
2160
- },
2161
- });
2162
- })($ || ($ = {}));
2163
- //mol/delegate/delegate.test.ts
2164
- ;
2165
- "use strict";
2166
- var $;
2167
2251
  (function ($_1) {
2168
2252
  $mol_test({
2169
- 'tree parsing'() {
2170
- $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
2171
- $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
2172
- $mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
2173
- $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
2174
- $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
2175
- $mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
2176
- $mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
2177
- $mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
2178
- },
2179
- 'inserting'() {
2180
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
2181
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
2182
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
2183
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
2184
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
2185
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
2186
- },
2187
- 'fromJSON'() {
2188
- $mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
2189
- $mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
2190
- $mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
2191
- $mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
2192
- $mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
2193
- },
2194
- 'toJSON'() {
2195
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
2196
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
2197
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
2198
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
2199
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
2200
- },
2201
- 'hack'() {
2202
- const res = $mol_tree.fromString(`foo bar xxx`).hack({
2203
- '': (tree, context) => [tree.hack(context)],
2204
- 'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
2205
- });
2206
- $mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
2207
- },
2208
- 'errors handling'($) {
2209
- const errors = [];
2210
- class Tree extends $mol_tree {
2211
- static $ = $.$mol_ambient({
2212
- $mol_fail: error => errors.push(error.message)
2213
- });
2214
- }
2215
- Tree.fromString(`
2216
- \t \tfoo
2217
- bar \\data
2218
- `, 'test');
2219
- $mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
2253
+ 'FQN of anon function'($) {
2254
+ const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
2255
+ $mol_assert_equal($$.$mol_func_name_test.name, '');
2256
+ $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
2257
+ $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
2220
2258
  },
2221
2259
  });
2222
2260
  })($ || ($ = {}));
2223
- //mol/tree/tree.test.ts
2261
+ //mol/func/name/name.test.ts
2224
2262
  ;
2225
2263
  "use strict";
2226
2264
  var $;
@@ -2256,44 +2294,6 @@ var $;
2256
2294
  ;
2257
2295
  "use strict";
2258
2296
  var $;
2259
- (function ($_1) {
2260
- $mol_test({
2261
- 'FQN of anon function'($) {
2262
- const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
2263
- $mol_assert_equal($$.$mol_func_name_test.name, '');
2264
- $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
2265
- $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
2266
- },
2267
- });
2268
- })($ || ($ = {}));
2269
- //mol/func/name/name.test.ts
2270
- ;
2271
- "use strict";
2272
- var $;
2273
- (function ($) {
2274
- $mol_test({
2275
- 'parse and serial'() {
2276
- $mol_assert_equal(new $mol_time_duration('P42.1Y').toString(), 'P42.1YT');
2277
- $mol_assert_equal(new $mol_time_duration('P42.1M').toString(), 'P42.1MT');
2278
- $mol_assert_equal(new $mol_time_duration('P42.1D').toString(), 'P42.1DT');
2279
- $mol_assert_equal(new $mol_time_duration('PT42.1h').toString(), 'PT42.1H');
2280
- $mol_assert_equal(new $mol_time_duration('PT42.1m').toString(), 'PT42.1M');
2281
- $mol_assert_equal(new $mol_time_duration('PT42.1s').toString(), 'PT42.1S');
2282
- $mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6.7s').toString(), 'P1Y2M3DT4H5M6.7S');
2283
- },
2284
- 'format typed'() {
2285
- $mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
2286
- },
2287
- 'comparison'() {
2288
- const iso = 'P1Y1M1DT1h1m1s';
2289
- $mol_assert_like(new $mol_time_duration(iso), new $mol_time_duration(iso));
2290
- },
2291
- });
2292
- })($ || ($ = {}));
2293
- //mol/time/duration/duration.test.ts
2294
- ;
2295
- "use strict";
2296
- var $;
2297
2297
  (function ($) {
2298
2298
  $mol_test({
2299
2299
  'parse and serial'() {