mol_time_all 1.1.849 → 1.1.851

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.deps.json CHANGED
@@ -1 +1 @@
1
- {"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/time/readme.md","mol/time/base/base.ts","mol/time/duration/readme.md","mol/time/duration/duration.ts","mol/fail/fail.ts","mol/dev/format/format.ts","mol/time/moment/moment.ts","mol/time/moment/readme.md","mol/time/interval/readme.md","mol/time/interval/interval.ts","mol/time/all/package.json","mol/time/all/all.meta.tree"],"mods":{},"deps_in":{"mol/time":{"mol/time/all":-9007199254740991,"mol/time/moment":-9007199254740991,"mol/time/duration":-9007199254740991,"mol/time/base":-9007199254740991,"mol/time/interval":-9007199254740991},"mol":{"mol/time":-9007199254740991,"mol/fail":-9007199254740991,"mol/dev":-9007199254740991},"":{"mol":-9007199254740991},"mol/time/moment":{"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/duration":{"mol/time/moment":-2,"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/base":{"mol/time/duration":-1,"mol/time/moment":-1,"mol/time/interval":-1},"mol/fail":{"mol/time/moment":-2},"mol/dev/format":{"mol/time/moment":-2},"mol/dev":{"mol/dev/format":-9007199254740991},"mol/time/interval":{"mol/time/all":-9000}},"deps_out":{"mol/time/all":{"mol/time":-9007199254740991,"mol/time/moment":-9000,"mol/time/duration":-9000,"mol/time/interval":-9000},"mol/time":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/time/moment":{"mol/time":-9007199254740991,"mol/time/duration":-2,"mol/fail":-2,"mol/time/base":-1,"mol/dev/format":-2},"mol/time/duration":{"mol/time":-9007199254740991,"mol/time/base":-1},"mol/time/base":{"mol/time":-9007199254740991},"mol/fail":{"mol":-9007199254740991},"mol/dev/format":{"mol/dev":-9007199254740991},"mol/dev":{"mol":-9007199254740991},"mol/time/interval":{"mol/time":-9007199254740991,"mol/time/moment":-2,"mol/time/duration":-2,"mol/time/base":-1}},"sloc":{"ts":709,"LICENSE":113,"md":705,"lock":974,"js":9,"json":95,"tree":44,"CNAME":1,"html":1},"deps":{"mol/time/all":{"..":-9007199254740991,"/mol/time/moment":-9000,"/mol/time/duration":-9000,"/mol/time/interval":-9000},"mol/time":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/time/moment":{"..":-9007199254740991,"/mol/time/moment/weekdays":-1,"/mol/time/moment/config":-1,"/mol/time/duration/config":-2,"/mol/fail":-2,"/mol/time/moment":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/dev/format/head":-2,"/mol/dev/format/span":-3,"/mol/dev/format/native":-4,"/mol/dev/format/accent":-4,"/mol/time/moment/patterns":-4},"mol/time/duration":{"..":-9007199254740991,"/mol/time/duration/config":-1,"/mol/time/duration":-1,"/mol/time/base":-1},"mol/time/base":{"..":-9007199254740991,"/mol/time/base":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/dev/format":{"..":-9007199254740991,"/mol/dev/format/register":-1,"/mol/dev/format/head":-1,"/mol/dev/format/body":-1,"/mol/dev/format/accent":-1,"/mol/dev/format/native":-1,"/mol/dev/format/shade":-1,"/mol/dev/format/auto":-1,"/mol/dev/format/element":-1,"/mol/dev/format/span":-1,"/mol/dev/format/div":-1,"/mol/dev/format/element/bind":-1,"/mol/dev/format/ol":-1,"/mol/dev/format/li":-1,"/mol/dev/format/table":-1,"/mol/dev/format/tr":-1,"/mol/dev/format/td":-1,"/mol/dev/format/span/bind":-1,"/mol/dev/format/strong":-1,"/mol/dev/format/string":-1,"/mol/dev/format/indent":-1,"/mol/dev/format/div/bind":-1},"mol/dev":{"..":-9007199254740991},"mol/time/interval":{"..":-9007199254740991,"/mol/time/interval/config":-1,"/mol/time/moment/config":-2,"/mol/time/duration/config":-2,"/mol/time/interval":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment":-2}}}
1
+ {"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/time/readme.md","mol/time/base/base.ts","mol/time/duration/readme.md","mol/time/duration/duration.ts","mol/fail/fail.ts","mol/dev/format/format.ts","mol/time/moment/moment.ts","mol/time/moment/readme.md","mol/time/interval/readme.md","mol/time/interval/interval.ts","mol/time/all/package.json","mol/time/all/all.meta.tree"],"mods":{},"deps_in":{"mol/time":{"mol/time/all":-9007199254740991,"mol/time/moment":-9007199254740991,"mol/time/duration":-9007199254740991,"mol/time/base":-9007199254740991,"mol/time/interval":-9007199254740991},"mol":{"mol/time":-9007199254740991,"mol/fail":-9007199254740991,"mol/dev":-9007199254740991},"":{"mol":-9007199254740991},"mol/time/moment":{"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/duration":{"mol/time/moment":-2,"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/base":{"mol/time/duration":-1,"mol/time/moment":-1,"mol/time/interval":-1},"mol/fail":{"mol/time/moment":-2},"mol/dev/format":{"mol/time/moment":-2},"mol/dev":{"mol/dev/format":-9007199254740991},"mol/time/interval":{"mol/time/all":-9000}},"deps_out":{"mol/time/all":{"mol/time":-9007199254740991,"mol/time/moment":-9000,"mol/time/duration":-9000,"mol/time/interval":-9000},"mol/time":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/time/moment":{"mol/time":-9007199254740991,"mol/time/duration":-2,"mol/fail":-2,"mol/time/base":-1,"mol/dev/format":-2},"mol/time/duration":{"mol/time":-9007199254740991,"mol/time/base":-1},"mol/time/base":{"mol/time":-9007199254740991},"mol/fail":{"mol":-9007199254740991},"mol/dev/format":{"mol/dev":-9007199254740991},"mol/dev":{"mol":-9007199254740991},"mol/time/interval":{"mol/time":-9007199254740991,"mol/time/moment":-2,"mol/time/duration":-2,"mol/time/base":-1}},"sloc":{"ts":709,"LICENSE":113,"md":705,"lock":974,"js":9,"json":96,"tree":44,"CNAME":1,"html":1},"deps":{"mol/time/all":{"..":-9007199254740991,"/mol/time/moment":-9000,"/mol/time/duration":-9000,"/mol/time/interval":-9000},"mol/time":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/time/moment":{"..":-9007199254740991,"/mol/time/moment/weekdays":-1,"/mol/time/moment/config":-1,"/mol/time/duration/config":-2,"/mol/fail":-2,"/mol/time/moment":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/dev/format/head":-2,"/mol/dev/format/span":-3,"/mol/dev/format/native":-4,"/mol/dev/format/accent":-4,"/mol/time/moment/patterns":-4},"mol/time/duration":{"..":-9007199254740991,"/mol/time/duration/config":-1,"/mol/time/duration":-1,"/mol/time/base":-1},"mol/time/base":{"..":-9007199254740991,"/mol/time/base":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/dev/format":{"..":-9007199254740991,"/mol/dev/format/register":-1,"/mol/dev/format/head":-1,"/mol/dev/format/body":-1,"/mol/dev/format/accent":-1,"/mol/dev/format/native":-1,"/mol/dev/format/shade":-1,"/mol/dev/format/auto":-1,"/mol/dev/format/element":-1,"/mol/dev/format/span":-1,"/mol/dev/format/div":-1,"/mol/dev/format/element/bind":-1,"/mol/dev/format/ol":-1,"/mol/dev/format/li":-1,"/mol/dev/format/table":-1,"/mol/dev/format/tr":-1,"/mol/dev/format/td":-1,"/mol/dev/format/span/bind":-1,"/mol/dev/format/strong":-1,"/mol/dev/format/string":-1,"/mol/dev/format/indent":-1,"/mol/dev/format/div/bind":-1},"mol/dev":{"..":-9007199254740991},"mol/time/interval":{"..":-9007199254740991,"/mol/time/interval/config":-1,"/mol/time/moment/config":-2,"/mol/time/duration/config":-2,"/mol/time/interval":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment":-2}}}
package/node.test.js CHANGED
@@ -1384,7 +1384,12 @@ var $;
1384
1384
  var $;
1385
1385
  (function ($) {
1386
1386
  function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
1387
- return new Proxy(new $mol_range2_array(), {
1387
+ const source = typeof item === 'function' ? new $mol_range2_array() : item;
1388
+ if (typeof item !== 'function') {
1389
+ item = index => source[index];
1390
+ size = () => source.length;
1391
+ }
1392
+ return new Proxy(source, {
1388
1393
  get(target, field) {
1389
1394
  if (typeof field === 'string') {
1390
1395
  if (field === 'length')
@@ -1397,7 +1402,7 @@ var $;
1397
1402
  if (index === Math.trunc(index))
1398
1403
  return item(index);
1399
1404
  }
1400
- return target[field];
1405
+ return $mol_range2_array.prototype[field];
1401
1406
  },
1402
1407
  set(target, field) {
1403
1408
  return $mol_fail(new TypeError(`Lazy range is read only (trying to set field ${JSON.stringify(field)})`));
@@ -1438,13 +1443,16 @@ var $;
1438
1443
  return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
1439
1444
  }
1440
1445
  filter(check, context) {
1441
- const filtered = new $mol_range2_array();
1442
- for (let index = 0; index < this.length; ++index) {
1443
- const item = this[index];
1444
- if (check.call(context, item, index, this))
1445
- filtered.push(item);
1446
- }
1447
- return filtered;
1446
+ const filtered = [];
1447
+ let cursor = -1;
1448
+ return $mol_range2(index => {
1449
+ while (cursor < this.length && index >= filtered.length - 1) {
1450
+ const val = this[++cursor];
1451
+ if (check(val, cursor, this))
1452
+ filtered.push(val);
1453
+ }
1454
+ return filtered[index];
1455
+ }, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
1448
1456
  }
1449
1457
  forEach(proceed, context) {
1450
1458
  for (let [key, value] of this.entries())
@@ -1504,7 +1512,7 @@ var $;
1504
1512
  'lazy calls'() {
1505
1513
  let calls = 0;
1506
1514
  const list = $mol_range2(index => (++calls, index), () => 10);
1507
- $mol_assert_ok(list instanceof Array);
1515
+ $mol_assert_equal(true, list instanceof Array);
1508
1516
  $mol_assert_equal(list.length, 10);
1509
1517
  $mol_assert_equal(list[-1], undefined);
1510
1518
  $mol_assert_equal(list[0], 0);
@@ -1547,11 +1555,17 @@ var $;
1547
1555
  $mol_range2(i => i, () => 5).forEach(i => log += i);
1548
1556
  $mol_assert_equal(log, '01234');
1549
1557
  },
1558
+ 'reduce'() {
1559
+ let calls = 0;
1560
+ const list = $mol_range2().slice(1, 6);
1561
+ $mol_assert_equal(list.reduce((s, v) => s + v), 15);
1562
+ $mol_assert_equal(list.reduce((s, v) => s + v, 5), 20);
1563
+ },
1550
1564
  'lazy concat'() {
1551
1565
  let calls1 = 0;
1552
1566
  let calls2 = 0;
1553
1567
  const list = $mol_range2(index => (++calls1, index), () => 5).concat([0, 1, 2, 3, 4], $mol_range2(index => (++calls2, index), () => 5));
1554
- $mol_assert_ok(list instanceof Array);
1568
+ $mol_assert_equal(true, list instanceof Array);
1555
1569
  $mol_assert_equal(list.length, 15);
1556
1570
  $mol_assert_equal(list[0], 0);
1557
1571
  $mol_assert_equal(list[4], 4);
@@ -1563,32 +1577,26 @@ var $;
1563
1577
  $mol_assert_equal(calls1, 2);
1564
1578
  $mol_assert_equal(calls2, 2);
1565
1579
  },
1566
- 'filter'() {
1580
+ 'lazy filter'() {
1567
1581
  let calls = 0;
1568
- const list = $mol_range2(index => (++calls, index), () => 10).filter(v => v % 2).slice(0, 3);
1569
- $mol_assert_ok(list instanceof Array);
1582
+ const list = $mol_range2(index => (++calls, index), () => 15).filter(v => v % 2).slice(0, 3);
1583
+ $mol_assert_equal(true, list instanceof Array);
1570
1584
  $mol_assert_equal(list.length, 3);
1571
1585
  $mol_assert_equal(list[0], 1);
1572
1586
  $mol_assert_equal(list[2], 5);
1573
1587
  $mol_assert_equal(list[3], undefined);
1574
- $mol_assert_equal(calls, 10);
1588
+ $mol_assert_equal(calls, 8);
1575
1589
  },
1576
- 'reverse'() {
1590
+ 'lazy reverse'() {
1577
1591
  let calls = 0;
1578
1592
  const list = $mol_range2(index => (++calls, index), () => 10).toReversed().slice(0, 3);
1579
- $mol_assert_ok(list instanceof Array);
1593
+ $mol_assert_equal(true, list instanceof Array);
1580
1594
  $mol_assert_equal(list.length, 3);
1581
1595
  $mol_assert_equal(list[0], 9);
1582
1596
  $mol_assert_equal(list[2], 7);
1583
1597
  $mol_assert_equal(list[3], undefined);
1584
1598
  $mol_assert_equal(calls, 2);
1585
1599
  },
1586
- 'reduce'() {
1587
- let calls = 0;
1588
- const list = $mol_range2().slice(1, 6);
1589
- $mol_assert_equal(list.reduce((s, v) => s + v), 15);
1590
- $mol_assert_equal(list.reduce((s, v) => s + v, 5), 20);
1591
- },
1592
1600
  'lazy map'() {
1593
1601
  let calls1 = 0;
1594
1602
  let calls2 = 0;
@@ -1598,7 +1606,7 @@ var $;
1598
1606
  $mol_assert_equal(source, self);
1599
1607
  return index + 10;
1600
1608
  }, () => 5);
1601
- $mol_assert_ok(target instanceof Array);
1609
+ $mol_assert_equal(true, target instanceof Array);
1602
1610
  $mol_assert_equal(target.length, 5);
1603
1611
  $mol_assert_equal(target[0], 10);
1604
1612
  $mol_assert_equal(target[4], 14);
@@ -1609,7 +1617,7 @@ var $;
1609
1617
  'lazy slice'() {
1610
1618
  let calls = 0;
1611
1619
  const list = $mol_range2(index => (++calls, index), () => 10).slice(3, 7);
1612
- $mol_assert_ok(list instanceof Array);
1620
+ $mol_assert_equal(true, list instanceof Array);
1613
1621
  $mol_assert_equal(list.length, 4);
1614
1622
  $mol_assert_equal(list[0], 3);
1615
1623
  $mol_assert_equal(list[3], 6);
@@ -1618,22 +1626,22 @@ var $;
1618
1626
  },
1619
1627
  'lazy some'() {
1620
1628
  let calls = 0;
1621
- $mol_assert_ok($mol_range2(index => (++calls, index), () => 5).some(v => v >= 2));
1629
+ $mol_assert_equal(true, $mol_range2(index => (++calls, index), () => 5).some(v => v >= 2));
1622
1630
  $mol_assert_equal(calls, 3);
1623
- $mol_assert_not($mol_range2(i => i, () => 0).some(v => true));
1624
- $mol_assert_ok($mol_range2(i => i).some(v => v > 5));
1631
+ $mol_assert_equal(false, $mol_range2(i => i, () => 0).some(v => true));
1632
+ $mol_assert_equal(true, $mol_range2(i => i).some(v => v > 5));
1625
1633
  },
1626
1634
  'lazy every'() {
1627
1635
  let calls = 0;
1628
- $mol_assert_not($mol_range2(index => (++calls, index), () => 5).every(v => v < 2));
1636
+ $mol_assert_equal(false, $mol_range2(index => (++calls, index), () => 5).every(v => v < 2));
1629
1637
  $mol_assert_equal(calls, 3);
1630
- $mol_assert_ok($mol_range2(i => i, () => 0).every(v => false));
1631
- $mol_assert_not($mol_range2(i => i).every(v => v < 5));
1638
+ $mol_assert_equal(true, $mol_range2(i => i, () => 0).every(v => false));
1639
+ $mol_assert_equal(false, $mol_range2(i => i).every(v => v < 5));
1632
1640
  },
1633
1641
  'lazyfy'() {
1634
1642
  let calls = 0;
1635
- const list = new $mol_range2_array(...[0, 1, 2, 3, 4, 5]).map(i => (++calls, i + 10)).slice(2);
1636
- $mol_assert_ok(list instanceof Array);
1643
+ const list = $mol_range2([0, 1, 2, 3, 4, 5]).map(i => (++calls, i + 10)).slice(2);
1644
+ $mol_assert_equal(true, list instanceof Array);
1637
1645
  $mol_assert_equal(list.length, 4);
1638
1646
  $mol_assert_equal(calls, 0);
1639
1647
  $mol_assert_equal(list[0], 12);