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/node.esm.js CHANGED
@@ -961,91 +961,125 @@ var $;
961
961
  "use strict";
962
962
  var $;
963
963
  (function ($) {
964
- const cache = new WeakMap();
965
- $.$mol_conform_stack = [];
966
- function $mol_conform(target, source) {
967
- if (Object.is(target, source))
968
- return source;
969
- if (!target || typeof target !== 'object')
970
- return target;
971
- if (!source || typeof source !== 'object')
972
- return target;
973
- if (target instanceof Error)
974
- return target;
975
- if (source instanceof Error)
976
- return target;
977
- if (target['constructor'] !== source['constructor'])
978
- return target;
979
- if (cache.get(target))
980
- return target;
981
- cache.set(target, true);
982
- const conform = $.$mol_conform_handlers.get(target['constructor']);
983
- if (!conform)
984
- return target;
985
- if ($.$mol_conform_stack.indexOf(target) !== -1)
986
- return target;
987
- $.$mol_conform_stack.push(target);
964
+ let cache = new WeakMap();
965
+ function $mol_compare_deep(left, right) {
966
+ if (Object.is(left, right))
967
+ return true;
968
+ if (left === null)
969
+ return false;
970
+ if (right === null)
971
+ return false;
972
+ if (typeof left !== 'object')
973
+ return false;
974
+ if (typeof right !== 'object')
975
+ return false;
976
+ const left_proto = Reflect.getPrototypeOf(left);
977
+ const right_proto = Reflect.getPrototypeOf(right);
978
+ if (left_proto !== right_proto)
979
+ return false;
980
+ if (left instanceof Boolean)
981
+ return Object.is(left.valueOf(), right['valueOf']());
982
+ if (left instanceof Number)
983
+ return Object.is(left.valueOf(), right['valueOf']());
984
+ if (left instanceof String)
985
+ return Object.is(left.valueOf(), right['valueOf']());
986
+ if (left instanceof Date)
987
+ return Object.is(left.valueOf(), right['valueOf']());
988
+ if (left instanceof RegExp)
989
+ return left.source === right['source'] && left.flags === right['flags'];
990
+ let left_cache = cache.get(left);
991
+ if (left_cache) {
992
+ const right_cache = left_cache.get(right);
993
+ if (typeof right_cache === 'boolean')
994
+ return right_cache;
995
+ }
996
+ else {
997
+ left_cache = new WeakMap([[right, true]]);
998
+ cache.set(left, left_cache);
999
+ }
1000
+ let result;
988
1001
  try {
989
- return conform(target, source);
1002
+ if (left_proto && !Reflect.getPrototypeOf(left_proto))
1003
+ result = compare_pojo(left, right);
1004
+ else if (Array.isArray(left))
1005
+ result = compare_array(left, right);
1006
+ else if (left instanceof Set)
1007
+ result = compare_set(left, right);
1008
+ else if (left instanceof Map)
1009
+ result = compare_map(left, right);
1010
+ else if (ArrayBuffer.isView(left))
1011
+ result = compare_buffer(left, right);
1012
+ else if (Symbol.toPrimitive in left)
1013
+ result = compare_primitive(left, right);
1014
+ else
1015
+ result = false;
990
1016
  }
991
1017
  finally {
992
- $.$mol_conform_stack.pop();
1018
+ left_cache.set(right, result);
993
1019
  }
1020
+ return result;
994
1021
  }
995
- $.$mol_conform = $mol_conform;
996
- $.$mol_conform_handlers = new WeakMap();
997
- function $mol_conform_handler(cl, handler) {
998
- $.$mol_conform_handlers.set(cl, handler);
999
- }
1000
- $.$mol_conform_handler = $mol_conform_handler;
1001
- function $mol_conform_array(target, source) {
1002
- if (source.length !== target.length)
1003
- return target;
1004
- for (let i = 0; i < target.length; ++i) {
1005
- if (!Object.is(source[i], target[i]))
1006
- return target;
1007
- }
1008
- return source;
1022
+ $.$mol_compare_deep = $mol_compare_deep;
1023
+ function compare_array(left, right) {
1024
+ const len = left.length;
1025
+ if (len !== right.length)
1026
+ return false;
1027
+ for (let i = 0; i < len; ++i) {
1028
+ if (!$mol_compare_deep(left[i], right[i]))
1029
+ return false;
1030
+ }
1031
+ return true;
1009
1032
  }
1010
- $.$mol_conform_array = $mol_conform_array;
1011
- $mol_conform_handler(Array, $mol_conform_array);
1012
- $mol_conform_handler(Uint8Array, $mol_conform_array);
1013
- $mol_conform_handler(Uint16Array, $mol_conform_array);
1014
- $mol_conform_handler(Uint32Array, $mol_conform_array);
1015
- $mol_conform_handler(({})['constructor'], (target, source) => {
1016
- let count = 0;
1017
- let equal = true;
1018
- for (let key in target) {
1019
- const conformed = $mol_conform(target[key], source[key]);
1020
- if (conformed !== target[key]) {
1021
- try {
1022
- target[key] = conformed;
1023
- }
1024
- catch (error) { }
1025
- if (!Object.is(conformed, target[key]))
1026
- equal = false;
1027
- }
1028
- if (!Object.is(conformed, source[key]))
1029
- equal = false;
1030
- ++count;
1033
+ function compare_buffer(left, right) {
1034
+ const len = left.byteLength;
1035
+ if (len !== right.byteLength)
1036
+ return false;
1037
+ for (let i = 0; i < len; ++i) {
1038
+ if (left[i] !== right[i])
1039
+ return false;
1031
1040
  }
1032
- for (let key in source)
1033
- if (--count < 0)
1041
+ return true;
1042
+ }
1043
+ function compare_iterator(left, right, compare) {
1044
+ while (true) {
1045
+ const left_next = left.next();
1046
+ const right_next = right.next();
1047
+ if (left_next.done !== right_next.done)
1048
+ return false;
1049
+ if (left_next.done)
1034
1050
  break;
1035
- return (equal && count === 0) ? source : target;
1036
- });
1037
- $mol_conform_handler(Date, (target, source) => {
1038
- if (target.getTime() === source.getTime())
1039
- return source;
1040
- return target;
1041
- });
1042
- $mol_conform_handler(RegExp, (target, source) => {
1043
- if (target.toString() === source.toString())
1044
- return source;
1045
- return target;
1046
- });
1051
+ if (!compare(left_next.value, right_next.value))
1052
+ return false;
1053
+ }
1054
+ return true;
1055
+ }
1056
+ function compare_set(left, right) {
1057
+ if (left.size !== right.size)
1058
+ return false;
1059
+ return compare_iterator(left.values(), right.values(), $mol_compare_deep);
1060
+ }
1061
+ function compare_map(left, right) {
1062
+ if (left.size !== right.size)
1063
+ return false;
1064
+ return compare_iterator(left.keys(), right.keys(), Object.is)
1065
+ && compare_iterator(left.values(), right.values(), $mol_compare_deep);
1066
+ }
1067
+ function compare_pojo(left, right) {
1068
+ const left_keys = Object.getOwnPropertyNames(left);
1069
+ const right_keys = Object.getOwnPropertyNames(right);
1070
+ if (left_keys.length !== right_keys.length)
1071
+ return false;
1072
+ for (let key of left_keys) {
1073
+ if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
1074
+ return false;
1075
+ }
1076
+ return true;
1077
+ }
1078
+ function compare_primitive(left, right) {
1079
+ return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
1080
+ }
1047
1081
  })($ || ($ = {}));
1048
- //conform.js.map
1082
+ //deep.js.map
1049
1083
  ;
1050
1084
  "use strict";
1051
1085
  var $;
@@ -1372,8 +1406,7 @@ var $;
1372
1406
  }
1373
1407
  }
1374
1408
  push(value) {
1375
- value = this.$.$mol_conform(value, this.value);
1376
- if (this.error !== null || !Object.is(this.value, value)) {
1409
+ if (this.error !== null || !$.$mol_compare_deep(this.value, value)) {
1377
1410
  if ($mol_fiber.logs)
1378
1411
  this.$.$mol_log3_done({
1379
1412
  place: this,