mol_plot_all 1.2.129 → 1.2.133

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/web.js CHANGED
@@ -549,91 +549,125 @@ var $;
549
549
  "use strict";
550
550
  var $;
551
551
  (function ($) {
552
- const cache = new WeakMap();
553
- $.$mol_conform_stack = [];
554
- function $mol_conform(target, source) {
555
- if (Object.is(target, source))
556
- return source;
557
- if (!target || typeof target !== 'object')
558
- return target;
559
- if (!source || typeof source !== 'object')
560
- return target;
561
- if (target instanceof Error)
562
- return target;
563
- if (source instanceof Error)
564
- return target;
565
- if (target['constructor'] !== source['constructor'])
566
- return target;
567
- if (cache.get(target))
568
- return target;
569
- cache.set(target, true);
570
- const conform = $.$mol_conform_handlers.get(target['constructor']);
571
- if (!conform)
572
- return target;
573
- if ($.$mol_conform_stack.indexOf(target) !== -1)
574
- return target;
575
- $.$mol_conform_stack.push(target);
552
+ let cache = new WeakMap();
553
+ function $mol_compare_deep(left, right) {
554
+ if (Object.is(left, right))
555
+ return true;
556
+ if (left === null)
557
+ return false;
558
+ if (right === null)
559
+ return false;
560
+ if (typeof left !== 'object')
561
+ return false;
562
+ if (typeof right !== 'object')
563
+ return false;
564
+ const left_proto = Reflect.getPrototypeOf(left);
565
+ const right_proto = Reflect.getPrototypeOf(right);
566
+ if (left_proto !== right_proto)
567
+ return false;
568
+ if (left instanceof Boolean)
569
+ return Object.is(left.valueOf(), right['valueOf']());
570
+ if (left instanceof Number)
571
+ return Object.is(left.valueOf(), right['valueOf']());
572
+ if (left instanceof String)
573
+ return Object.is(left.valueOf(), right['valueOf']());
574
+ if (left instanceof Date)
575
+ return Object.is(left.valueOf(), right['valueOf']());
576
+ if (left instanceof RegExp)
577
+ return left.source === right['source'] && left.flags === right['flags'];
578
+ let left_cache = cache.get(left);
579
+ if (left_cache) {
580
+ const right_cache = left_cache.get(right);
581
+ if (typeof right_cache === 'boolean')
582
+ return right_cache;
583
+ }
584
+ else {
585
+ left_cache = new WeakMap([[right, true]]);
586
+ cache.set(left, left_cache);
587
+ }
588
+ let result;
576
589
  try {
577
- return conform(target, source);
590
+ if (left_proto && !Reflect.getPrototypeOf(left_proto))
591
+ result = compare_pojo(left, right);
592
+ else if (Array.isArray(left))
593
+ result = compare_array(left, right);
594
+ else if (left instanceof Set)
595
+ result = compare_set(left, right);
596
+ else if (left instanceof Map)
597
+ result = compare_map(left, right);
598
+ else if (ArrayBuffer.isView(left))
599
+ result = compare_buffer(left, right);
600
+ else if (Symbol.toPrimitive in left)
601
+ result = compare_primitive(left, right);
602
+ else
603
+ result = false;
578
604
  }
579
605
  finally {
580
- $.$mol_conform_stack.pop();
606
+ left_cache.set(right, result);
581
607
  }
608
+ return result;
582
609
  }
583
- $.$mol_conform = $mol_conform;
584
- $.$mol_conform_handlers = new WeakMap();
585
- function $mol_conform_handler(cl, handler) {
586
- $.$mol_conform_handlers.set(cl, handler);
587
- }
588
- $.$mol_conform_handler = $mol_conform_handler;
589
- function $mol_conform_array(target, source) {
590
- if (source.length !== target.length)
591
- return target;
592
- for (let i = 0; i < target.length; ++i) {
593
- if (!Object.is(source[i], target[i]))
594
- return target;
595
- }
596
- return source;
610
+ $.$mol_compare_deep = $mol_compare_deep;
611
+ function compare_array(left, right) {
612
+ const len = left.length;
613
+ if (len !== right.length)
614
+ return false;
615
+ for (let i = 0; i < len; ++i) {
616
+ if (!$mol_compare_deep(left[i], right[i]))
617
+ return false;
618
+ }
619
+ return true;
597
620
  }
598
- $.$mol_conform_array = $mol_conform_array;
599
- $mol_conform_handler(Array, $mol_conform_array);
600
- $mol_conform_handler(Uint8Array, $mol_conform_array);
601
- $mol_conform_handler(Uint16Array, $mol_conform_array);
602
- $mol_conform_handler(Uint32Array, $mol_conform_array);
603
- $mol_conform_handler(({})['constructor'], (target, source) => {
604
- let count = 0;
605
- let equal = true;
606
- for (let key in target) {
607
- const conformed = $mol_conform(target[key], source[key]);
608
- if (conformed !== target[key]) {
609
- try {
610
- target[key] = conformed;
611
- }
612
- catch (error) { }
613
- if (!Object.is(conformed, target[key]))
614
- equal = false;
615
- }
616
- if (!Object.is(conformed, source[key]))
617
- equal = false;
618
- ++count;
621
+ function compare_buffer(left, right) {
622
+ const len = left.byteLength;
623
+ if (len !== right.byteLength)
624
+ return false;
625
+ for (let i = 0; i < len; ++i) {
626
+ if (left[i] !== right[i])
627
+ return false;
619
628
  }
620
- for (let key in source)
621
- if (--count < 0)
629
+ return true;
630
+ }
631
+ function compare_iterator(left, right, compare) {
632
+ while (true) {
633
+ const left_next = left.next();
634
+ const right_next = right.next();
635
+ if (left_next.done !== right_next.done)
636
+ return false;
637
+ if (left_next.done)
622
638
  break;
623
- return (equal && count === 0) ? source : target;
624
- });
625
- $mol_conform_handler(Date, (target, source) => {
626
- if (target.getTime() === source.getTime())
627
- return source;
628
- return target;
629
- });
630
- $mol_conform_handler(RegExp, (target, source) => {
631
- if (target.toString() === source.toString())
632
- return source;
633
- return target;
634
- });
639
+ if (!compare(left_next.value, right_next.value))
640
+ return false;
641
+ }
642
+ return true;
643
+ }
644
+ function compare_set(left, right) {
645
+ if (left.size !== right.size)
646
+ return false;
647
+ return compare_iterator(left.values(), right.values(), $mol_compare_deep);
648
+ }
649
+ function compare_map(left, right) {
650
+ if (left.size !== right.size)
651
+ return false;
652
+ return compare_iterator(left.keys(), right.keys(), Object.is)
653
+ && compare_iterator(left.values(), right.values(), $mol_compare_deep);
654
+ }
655
+ function compare_pojo(left, right) {
656
+ const left_keys = Object.getOwnPropertyNames(left);
657
+ const right_keys = Object.getOwnPropertyNames(right);
658
+ if (left_keys.length !== right_keys.length)
659
+ return false;
660
+ for (let key of left_keys) {
661
+ if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
662
+ return false;
663
+ }
664
+ return true;
665
+ }
666
+ function compare_primitive(left, right) {
667
+ return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
668
+ }
635
669
  })($ || ($ = {}));
636
- //conform.js.map
670
+ //deep.js.map
637
671
  ;
638
672
  "use strict";
639
673
  var $;
@@ -960,8 +994,7 @@ var $;
960
994
  }
961
995
  }
962
996
  push(value) {
963
- value = this.$.$mol_conform(value, this.value);
964
- if (this.error !== null || !Object.is(this.value, value)) {
997
+ if (this.error !== null || !$.$mol_compare_deep(this.value, value)) {
965
998
  if ($mol_fiber.logs)
966
999
  this.$.$mol_log3_done({
967
1000
  place: this,