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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_time_all",
3
- "version": "1.1.849",
3
+ "version": "1.1.851",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.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/web.test.js CHANGED
@@ -429,7 +429,12 @@ var $;
429
429
  var $;
430
430
  (function ($) {
431
431
  function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
432
- return new Proxy(new $mol_range2_array(), {
432
+ const source = typeof item === 'function' ? new $mol_range2_array() : item;
433
+ if (typeof item !== 'function') {
434
+ item = index => source[index];
435
+ size = () => source.length;
436
+ }
437
+ return new Proxy(source, {
433
438
  get(target, field) {
434
439
  if (typeof field === 'string') {
435
440
  if (field === 'length')
@@ -442,7 +447,7 @@ var $;
442
447
  if (index === Math.trunc(index))
443
448
  return item(index);
444
449
  }
445
- return target[field];
450
+ return $mol_range2_array.prototype[field];
446
451
  },
447
452
  set(target, field) {
448
453
  return $mol_fail(new TypeError(`Lazy range is read only (trying to set field ${JSON.stringify(field)})`));
@@ -483,13 +488,16 @@ var $;
483
488
  return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
484
489
  }
485
490
  filter(check, context) {
486
- const filtered = new $mol_range2_array();
487
- for (let index = 0; index < this.length; ++index) {
488
- const item = this[index];
489
- if (check.call(context, item, index, this))
490
- filtered.push(item);
491
- }
492
- return filtered;
491
+ const filtered = [];
492
+ let cursor = -1;
493
+ return $mol_range2(index => {
494
+ while (cursor < this.length && index >= filtered.length - 1) {
495
+ const val = this[++cursor];
496
+ if (check(val, cursor, this))
497
+ filtered.push(val);
498
+ }
499
+ return filtered[index];
500
+ }, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
493
501
  }
494
502
  forEach(proceed, context) {
495
503
  for (let [key, value] of this.entries())
@@ -549,7 +557,7 @@ var $;
549
557
  'lazy calls'() {
550
558
  let calls = 0;
551
559
  const list = $mol_range2(index => (++calls, index), () => 10);
552
- $mol_assert_ok(list instanceof Array);
560
+ $mol_assert_equal(true, list instanceof Array);
553
561
  $mol_assert_equal(list.length, 10);
554
562
  $mol_assert_equal(list[-1], undefined);
555
563
  $mol_assert_equal(list[0], 0);
@@ -592,11 +600,17 @@ var $;
592
600
  $mol_range2(i => i, () => 5).forEach(i => log += i);
593
601
  $mol_assert_equal(log, '01234');
594
602
  },
603
+ 'reduce'() {
604
+ let calls = 0;
605
+ const list = $mol_range2().slice(1, 6);
606
+ $mol_assert_equal(list.reduce((s, v) => s + v), 15);
607
+ $mol_assert_equal(list.reduce((s, v) => s + v, 5), 20);
608
+ },
595
609
  'lazy concat'() {
596
610
  let calls1 = 0;
597
611
  let calls2 = 0;
598
612
  const list = $mol_range2(index => (++calls1, index), () => 5).concat([0, 1, 2, 3, 4], $mol_range2(index => (++calls2, index), () => 5));
599
- $mol_assert_ok(list instanceof Array);
613
+ $mol_assert_equal(true, list instanceof Array);
600
614
  $mol_assert_equal(list.length, 15);
601
615
  $mol_assert_equal(list[0], 0);
602
616
  $mol_assert_equal(list[4], 4);
@@ -608,32 +622,26 @@ var $;
608
622
  $mol_assert_equal(calls1, 2);
609
623
  $mol_assert_equal(calls2, 2);
610
624
  },
611
- 'filter'() {
625
+ 'lazy filter'() {
612
626
  let calls = 0;
613
- const list = $mol_range2(index => (++calls, index), () => 10).filter(v => v % 2).slice(0, 3);
614
- $mol_assert_ok(list instanceof Array);
627
+ const list = $mol_range2(index => (++calls, index), () => 15).filter(v => v % 2).slice(0, 3);
628
+ $mol_assert_equal(true, list instanceof Array);
615
629
  $mol_assert_equal(list.length, 3);
616
630
  $mol_assert_equal(list[0], 1);
617
631
  $mol_assert_equal(list[2], 5);
618
632
  $mol_assert_equal(list[3], undefined);
619
- $mol_assert_equal(calls, 10);
633
+ $mol_assert_equal(calls, 8);
620
634
  },
621
- 'reverse'() {
635
+ 'lazy reverse'() {
622
636
  let calls = 0;
623
637
  const list = $mol_range2(index => (++calls, index), () => 10).toReversed().slice(0, 3);
624
- $mol_assert_ok(list instanceof Array);
638
+ $mol_assert_equal(true, list instanceof Array);
625
639
  $mol_assert_equal(list.length, 3);
626
640
  $mol_assert_equal(list[0], 9);
627
641
  $mol_assert_equal(list[2], 7);
628
642
  $mol_assert_equal(list[3], undefined);
629
643
  $mol_assert_equal(calls, 2);
630
644
  },
631
- 'reduce'() {
632
- let calls = 0;
633
- const list = $mol_range2().slice(1, 6);
634
- $mol_assert_equal(list.reduce((s, v) => s + v), 15);
635
- $mol_assert_equal(list.reduce((s, v) => s + v, 5), 20);
636
- },
637
645
  'lazy map'() {
638
646
  let calls1 = 0;
639
647
  let calls2 = 0;
@@ -643,7 +651,7 @@ var $;
643
651
  $mol_assert_equal(source, self);
644
652
  return index + 10;
645
653
  }, () => 5);
646
- $mol_assert_ok(target instanceof Array);
654
+ $mol_assert_equal(true, target instanceof Array);
647
655
  $mol_assert_equal(target.length, 5);
648
656
  $mol_assert_equal(target[0], 10);
649
657
  $mol_assert_equal(target[4], 14);
@@ -654,7 +662,7 @@ var $;
654
662
  'lazy slice'() {
655
663
  let calls = 0;
656
664
  const list = $mol_range2(index => (++calls, index), () => 10).slice(3, 7);
657
- $mol_assert_ok(list instanceof Array);
665
+ $mol_assert_equal(true, list instanceof Array);
658
666
  $mol_assert_equal(list.length, 4);
659
667
  $mol_assert_equal(list[0], 3);
660
668
  $mol_assert_equal(list[3], 6);
@@ -663,22 +671,22 @@ var $;
663
671
  },
664
672
  'lazy some'() {
665
673
  let calls = 0;
666
- $mol_assert_ok($mol_range2(index => (++calls, index), () => 5).some(v => v >= 2));
674
+ $mol_assert_equal(true, $mol_range2(index => (++calls, index), () => 5).some(v => v >= 2));
667
675
  $mol_assert_equal(calls, 3);
668
- $mol_assert_not($mol_range2(i => i, () => 0).some(v => true));
669
- $mol_assert_ok($mol_range2(i => i).some(v => v > 5));
676
+ $mol_assert_equal(false, $mol_range2(i => i, () => 0).some(v => true));
677
+ $mol_assert_equal(true, $mol_range2(i => i).some(v => v > 5));
670
678
  },
671
679
  'lazy every'() {
672
680
  let calls = 0;
673
- $mol_assert_not($mol_range2(index => (++calls, index), () => 5).every(v => v < 2));
681
+ $mol_assert_equal(false, $mol_range2(index => (++calls, index), () => 5).every(v => v < 2));
674
682
  $mol_assert_equal(calls, 3);
675
- $mol_assert_ok($mol_range2(i => i, () => 0).every(v => false));
676
- $mol_assert_not($mol_range2(i => i).every(v => v < 5));
683
+ $mol_assert_equal(true, $mol_range2(i => i, () => 0).every(v => false));
684
+ $mol_assert_equal(false, $mol_range2(i => i).every(v => v < 5));
677
685
  },
678
686
  'lazyfy'() {
679
687
  let calls = 0;
680
- const list = new $mol_range2_array(...[0, 1, 2, 3, 4, 5]).map(i => (++calls, i + 10)).slice(2);
681
- $mol_assert_ok(list instanceof Array);
688
+ const list = $mol_range2([0, 1, 2, 3, 4, 5]).map(i => (++calls, i + 10)).slice(2);
689
+ $mol_assert_equal(true, list instanceof Array);
682
690
  $mol_assert_equal(list.length, 4);
683
691
  $mol_assert_equal(calls, 0);
684
692
  $mol_assert_equal(list[0], 12);