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.d.ts +1 -10
- package/node.deps.json +1 -1
- package/node.esm.js +111 -78
- package/node.esm.js.map +1 -1
- package/node.js +111 -78
- package/node.js.map +1 -1
- package/node.test.js +138 -442
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +1 -10
- package/web.deps.json +1 -1
- package/web.esm.js +111 -78
- package/web.esm.js.map +1 -1
- package/web.js +111 -78
- package/web.js.map +1 -1
- package/web.test.js +24 -361
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -953,91 +953,125 @@ var $;
|
|
|
953
953
|
"use strict";
|
|
954
954
|
var $;
|
|
955
955
|
(function ($) {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
956
|
+
let cache = new WeakMap();
|
|
957
|
+
function $mol_compare_deep(left, right) {
|
|
958
|
+
if (Object.is(left, right))
|
|
959
|
+
return true;
|
|
960
|
+
if (left === null)
|
|
961
|
+
return false;
|
|
962
|
+
if (right === null)
|
|
963
|
+
return false;
|
|
964
|
+
if (typeof left !== 'object')
|
|
965
|
+
return false;
|
|
966
|
+
if (typeof right !== 'object')
|
|
967
|
+
return false;
|
|
968
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
969
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
970
|
+
if (left_proto !== right_proto)
|
|
971
|
+
return false;
|
|
972
|
+
if (left instanceof Boolean)
|
|
973
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
974
|
+
if (left instanceof Number)
|
|
975
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
976
|
+
if (left instanceof String)
|
|
977
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
978
|
+
if (left instanceof Date)
|
|
979
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
980
|
+
if (left instanceof RegExp)
|
|
981
|
+
return left.source === right['source'] && left.flags === right['flags'];
|
|
982
|
+
let left_cache = cache.get(left);
|
|
983
|
+
if (left_cache) {
|
|
984
|
+
const right_cache = left_cache.get(right);
|
|
985
|
+
if (typeof right_cache === 'boolean')
|
|
986
|
+
return right_cache;
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
left_cache = new WeakMap([[right, true]]);
|
|
990
|
+
cache.set(left, left_cache);
|
|
991
|
+
}
|
|
992
|
+
let result;
|
|
980
993
|
try {
|
|
981
|
-
|
|
994
|
+
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
995
|
+
result = compare_pojo(left, right);
|
|
996
|
+
else if (Array.isArray(left))
|
|
997
|
+
result = compare_array(left, right);
|
|
998
|
+
else if (left instanceof Set)
|
|
999
|
+
result = compare_set(left, right);
|
|
1000
|
+
else if (left instanceof Map)
|
|
1001
|
+
result = compare_map(left, right);
|
|
1002
|
+
else if (ArrayBuffer.isView(left))
|
|
1003
|
+
result = compare_buffer(left, right);
|
|
1004
|
+
else if (Symbol.toPrimitive in left)
|
|
1005
|
+
result = compare_primitive(left, right);
|
|
1006
|
+
else
|
|
1007
|
+
result = false;
|
|
982
1008
|
}
|
|
983
1009
|
finally {
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
$.$
|
|
989
|
-
function
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
for (let i = 0; i < target.length; ++i) {
|
|
997
|
-
if (!Object.is(source[i], target[i]))
|
|
998
|
-
return target;
|
|
999
|
-
}
|
|
1000
|
-
return source;
|
|
1001
|
-
}
|
|
1002
|
-
$.$mol_conform_array = $mol_conform_array;
|
|
1003
|
-
$mol_conform_handler(Array, $mol_conform_array);
|
|
1004
|
-
$mol_conform_handler(Uint8Array, $mol_conform_array);
|
|
1005
|
-
$mol_conform_handler(Uint16Array, $mol_conform_array);
|
|
1006
|
-
$mol_conform_handler(Uint32Array, $mol_conform_array);
|
|
1007
|
-
$mol_conform_handler(({})['constructor'], (target, source) => {
|
|
1008
|
-
let count = 0;
|
|
1009
|
-
let equal = true;
|
|
1010
|
-
for (let key in target) {
|
|
1011
|
-
const conformed = $mol_conform(target[key], source[key]);
|
|
1012
|
-
if (conformed !== target[key]) {
|
|
1013
|
-
try {
|
|
1014
|
-
target[key] = conformed;
|
|
1015
|
-
}
|
|
1016
|
-
catch (error) { }
|
|
1017
|
-
if (!Object.is(conformed, target[key]))
|
|
1018
|
-
equal = false;
|
|
1019
|
-
}
|
|
1020
|
-
if (!Object.is(conformed, source[key]))
|
|
1021
|
-
equal = false;
|
|
1022
|
-
++count;
|
|
1010
|
+
left_cache.set(right, result);
|
|
1011
|
+
}
|
|
1012
|
+
return result;
|
|
1013
|
+
}
|
|
1014
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
1015
|
+
function compare_array(left, right) {
|
|
1016
|
+
const len = left.length;
|
|
1017
|
+
if (len !== right.length)
|
|
1018
|
+
return false;
|
|
1019
|
+
for (let i = 0; i < len; ++i) {
|
|
1020
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
1021
|
+
return false;
|
|
1023
1022
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
function compare_buffer(left, right) {
|
|
1026
|
+
const len = left.byteLength;
|
|
1027
|
+
if (len !== right.byteLength)
|
|
1028
|
+
return false;
|
|
1029
|
+
for (let i = 0; i < len; ++i) {
|
|
1030
|
+
if (left[i] !== right[i])
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
function compare_iterator(left, right, compare) {
|
|
1036
|
+
while (true) {
|
|
1037
|
+
const left_next = left.next();
|
|
1038
|
+
const right_next = right.next();
|
|
1039
|
+
if (left_next.done !== right_next.done)
|
|
1040
|
+
return false;
|
|
1041
|
+
if (left_next.done)
|
|
1026
1042
|
break;
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1043
|
+
if (!compare(left_next.value, right_next.value))
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
function compare_set(left, right) {
|
|
1049
|
+
if (left.size !== right.size)
|
|
1050
|
+
return false;
|
|
1051
|
+
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
1052
|
+
}
|
|
1053
|
+
function compare_map(left, right) {
|
|
1054
|
+
if (left.size !== right.size)
|
|
1055
|
+
return false;
|
|
1056
|
+
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
1057
|
+
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
1058
|
+
}
|
|
1059
|
+
function compare_pojo(left, right) {
|
|
1060
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
1061
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
1062
|
+
if (left_keys.length !== right_keys.length)
|
|
1063
|
+
return false;
|
|
1064
|
+
for (let key of left_keys) {
|
|
1065
|
+
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
1066
|
+
return false;
|
|
1067
|
+
}
|
|
1068
|
+
return true;
|
|
1069
|
+
}
|
|
1070
|
+
function compare_primitive(left, right) {
|
|
1071
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
1072
|
+
}
|
|
1039
1073
|
})($ || ($ = {}));
|
|
1040
|
-
//
|
|
1074
|
+
//deep.js.map
|
|
1041
1075
|
;
|
|
1042
1076
|
"use strict";
|
|
1043
1077
|
var $;
|
|
@@ -1364,8 +1398,7 @@ var $;
|
|
|
1364
1398
|
}
|
|
1365
1399
|
}
|
|
1366
1400
|
push(value) {
|
|
1367
|
-
|
|
1368
|
-
if (this.error !== null || !Object.is(this.value, value)) {
|
|
1401
|
+
if (this.error !== null || !$.$mol_compare_deep(this.value, value)) {
|
|
1369
1402
|
if ($mol_fiber.logs)
|
|
1370
1403
|
this.$.$mol_log3_done({
|
|
1371
1404
|
place: this,
|
|
@@ -6100,23 +6133,16 @@ var $;
|
|
|
6100
6133
|
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
6101
6134
|
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
6102
6135
|
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
6103
|
-
},
|
|
6104
|
-
'Number'() {
|
|
6105
6136
|
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
6106
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
6107
6137
|
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
6108
6138
|
},
|
|
6109
|
-
'
|
|
6139
|
+
'POJO'() {
|
|
6110
6140
|
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
6111
|
-
},
|
|
6112
|
-
'different POJOs'() {
|
|
6113
6141
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
6114
|
-
},
|
|
6115
|
-
'different POJOs with same keys but different values'() {
|
|
6116
6142
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
6117
|
-
},
|
|
6118
|
-
'different POJOs with different keys but same values'() {
|
|
6119
6143
|
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
6144
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
6145
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
6120
6146
|
},
|
|
6121
6147
|
'Array'() {
|
|
6122
6148
|
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
@@ -6124,17 +6150,12 @@ var $;
|
|
|
6124
6150
|
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
6125
6151
|
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
6126
6152
|
},
|
|
6127
|
-
'
|
|
6128
|
-
|
|
6129
|
-
},
|
|
6130
|
-
'different classes with same values'() {
|
|
6131
|
-
class Obj {
|
|
6132
|
-
foo = 1;
|
|
6153
|
+
'Non POJO are different'() {
|
|
6154
|
+
class Thing extends Object {
|
|
6133
6155
|
}
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
$.$mol_assert_not($.$mol_compare_deep(a, b));
|
|
6156
|
+
$.$mol_assert_not($.$mol_compare_deep(new Thing, new Thing));
|
|
6157
|
+
$.$mol_assert_not($.$mol_compare_deep(() => 1, () => 1));
|
|
6158
|
+
$.$mol_assert_not($.$mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
6138
6159
|
},
|
|
6139
6160
|
'same POJOs with cyclic reference'() {
|
|
6140
6161
|
const a = { foo: {} };
|
|
@@ -6143,41 +6164,6 @@ var $;
|
|
|
6143
6164
|
b['self'] = b;
|
|
6144
6165
|
$.$mol_assert_ok($.$mol_compare_deep(a, b));
|
|
6145
6166
|
},
|
|
6146
|
-
'empty Element'() {
|
|
6147
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
|
|
6148
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
|
|
6149
|
-
},
|
|
6150
|
-
'Element with attributes'() {
|
|
6151
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
|
|
6152
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
|
|
6153
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
|
|
6154
|
-
},
|
|
6155
|
-
'Element with styles'() {
|
|
6156
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
|
|
6157
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
|
|
6158
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
|
|
6159
|
-
},
|
|
6160
|
-
'Element with content'() {
|
|
6161
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6162
|
-
"foo",
|
|
6163
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6164
|
-
"foo",
|
|
6165
|
-
$.$mol_jsx("br", null))));
|
|
6166
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6167
|
-
"foo",
|
|
6168
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6169
|
-
"bar",
|
|
6170
|
-
$.$mol_jsx("br", null))));
|
|
6171
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
6172
|
-
"foo",
|
|
6173
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
6174
|
-
"foo",
|
|
6175
|
-
$.$mol_jsx("hr", null))));
|
|
6176
|
-
},
|
|
6177
|
-
'Element with handlers'() {
|
|
6178
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
|
|
6179
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
|
|
6180
|
-
},
|
|
6181
6167
|
'Date'() {
|
|
6182
6168
|
$.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
|
|
6183
6169
|
$.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
|
|
@@ -6189,8 +6175,9 @@ var $;
|
|
|
6189
6175
|
},
|
|
6190
6176
|
'Map'() {
|
|
6191
6177
|
$.$mol_assert_ok($.$mol_compare_deep(new Map, new Map));
|
|
6192
|
-
$.$mol_assert_ok($.$mol_compare_deep(new Map([[
|
|
6178
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
6193
6179
|
$.$mol_assert_not($.$mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
6180
|
+
$.$mol_assert_not($.$mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
6194
6181
|
},
|
|
6195
6182
|
'Set'() {
|
|
6196
6183
|
$.$mol_assert_ok($.$mol_compare_deep(new Set, new Set));
|
|
@@ -6202,106 +6189,24 @@ var $;
|
|
|
6202
6189
|
$.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
6203
6190
|
$.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
6204
6191
|
},
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
;
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
const a_stack = [];
|
|
6213
|
-
const b_stack = [];
|
|
6214
|
-
let cache = null;
|
|
6215
|
-
function $mol_compare_deep(a, b) {
|
|
6216
|
-
if (Object.is(a, b))
|
|
6217
|
-
return true;
|
|
6218
|
-
const a_type = typeof a;
|
|
6219
|
-
const b_type = typeof b;
|
|
6220
|
-
if (a_type !== b_type)
|
|
6221
|
-
return false;
|
|
6222
|
-
if (a_type === 'function')
|
|
6223
|
-
return a['toString']() === b['toString']();
|
|
6224
|
-
if (a_type !== 'object')
|
|
6225
|
-
return false;
|
|
6226
|
-
if (!a || !b)
|
|
6227
|
-
return false;
|
|
6228
|
-
if (a instanceof Error)
|
|
6229
|
-
return false;
|
|
6230
|
-
if (a['constructor'] !== b['constructor'])
|
|
6231
|
-
return false;
|
|
6232
|
-
if (a instanceof RegExp)
|
|
6233
|
-
return a.toString() === b['toString']();
|
|
6234
|
-
const ref = a_stack.indexOf(a);
|
|
6235
|
-
if (ref >= 0) {
|
|
6236
|
-
return Object.is(b_stack[ref], b);
|
|
6237
|
-
}
|
|
6238
|
-
if (!cache)
|
|
6239
|
-
cache = new WeakMap;
|
|
6240
|
-
let a_cache = cache.get(a);
|
|
6241
|
-
if (a_cache) {
|
|
6242
|
-
const b_cache = a_cache.get(b);
|
|
6243
|
-
if (typeof b_cache === 'boolean')
|
|
6244
|
-
return b_cache;
|
|
6245
|
-
}
|
|
6246
|
-
else {
|
|
6247
|
-
a_cache = new WeakMap();
|
|
6248
|
-
cache.set(a, a_cache);
|
|
6249
|
-
}
|
|
6250
|
-
a_stack.push(a);
|
|
6251
|
-
b_stack.push(b);
|
|
6252
|
-
let result;
|
|
6253
|
-
try {
|
|
6254
|
-
if (Symbol.iterator in a) {
|
|
6255
|
-
const a_iter = a[Symbol.iterator]();
|
|
6256
|
-
const b_iter = b[Symbol.iterator]();
|
|
6257
|
-
while (true) {
|
|
6258
|
-
const a_next = a_iter.next();
|
|
6259
|
-
const b_next = b_iter.next();
|
|
6260
|
-
if (a_next.done !== b_next.done)
|
|
6261
|
-
return result = false;
|
|
6262
|
-
if (a_next.done)
|
|
6263
|
-
break;
|
|
6264
|
-
if (!$mol_compare_deep(a_next.value, b_next.value))
|
|
6265
|
-
return result = false;
|
|
6192
|
+
'Custom comparator'() {
|
|
6193
|
+
class User {
|
|
6194
|
+
name;
|
|
6195
|
+
rand;
|
|
6196
|
+
constructor(name, rand = Math.random()) {
|
|
6197
|
+
this.name = name;
|
|
6198
|
+
this.rand = rand;
|
|
6266
6199
|
}
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
let count = 0;
|
|
6270
|
-
for (let key in a) {
|
|
6271
|
-
try {
|
|
6272
|
-
if (!$mol_compare_deep(a[key], b[key]))
|
|
6273
|
-
return result = false;
|
|
6274
|
-
}
|
|
6275
|
-
catch (error) {
|
|
6276
|
-
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${a} and ${b}`, error));
|
|
6200
|
+
[Symbol.toPrimitive](mode) {
|
|
6201
|
+
return this.name;
|
|
6277
6202
|
}
|
|
6278
|
-
++count;
|
|
6279
|
-
}
|
|
6280
|
-
for (let key in b) {
|
|
6281
|
-
--count;
|
|
6282
|
-
if (count < 0)
|
|
6283
|
-
return result = false;
|
|
6284
|
-
}
|
|
6285
|
-
if (a instanceof Number || a instanceof String || a instanceof Symbol || a instanceof Boolean || a instanceof Date) {
|
|
6286
|
-
if (!Object.is(a['valueOf'](), b['valueOf']()))
|
|
6287
|
-
return result = false;
|
|
6288
|
-
}
|
|
6289
|
-
return result = true;
|
|
6290
|
-
}
|
|
6291
|
-
finally {
|
|
6292
|
-
a_stack.pop();
|
|
6293
|
-
b_stack.pop();
|
|
6294
|
-
if (a_stack.length === 0) {
|
|
6295
|
-
cache = null;
|
|
6296
|
-
}
|
|
6297
|
-
else {
|
|
6298
|
-
a_cache.set(b, result);
|
|
6299
6203
|
}
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6204
|
+
$.$mol_assert_ok($.$mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
6205
|
+
$.$mol_assert_not($.$mol_compare_deep(new User('Jin'), new User('John')));
|
|
6206
|
+
},
|
|
6207
|
+
});
|
|
6303
6208
|
})($ || ($ = {}));
|
|
6304
|
-
//deep.js.map
|
|
6209
|
+
//deep.test.js.map
|
|
6305
6210
|
;
|
|
6306
6211
|
"use strict";
|
|
6307
6212
|
var $;
|
|
@@ -6709,129 +6614,6 @@ var $;
|
|
|
6709
6614
|
;
|
|
6710
6615
|
"use strict";
|
|
6711
6616
|
var $;
|
|
6712
|
-
(function ($) {
|
|
6713
|
-
$.$mol_test({
|
|
6714
|
-
'return source when same object'() {
|
|
6715
|
-
const target = {};
|
|
6716
|
-
$.$mol_assert_equal($.$mol_conform(target, target), target);
|
|
6717
|
-
},
|
|
6718
|
-
'return target when some is not object'() {
|
|
6719
|
-
const obj = { a: 1 };
|
|
6720
|
-
$.$mol_assert_equal($.$mol_conform(true, obj), true);
|
|
6721
|
-
$.$mol_assert_equal($.$mol_conform(obj, true), obj);
|
|
6722
|
-
},
|
|
6723
|
-
'return target when some is null'() {
|
|
6724
|
-
const obj = { a: 1 };
|
|
6725
|
-
$.$mol_assert_equal($.$mol_conform(null, obj), null);
|
|
6726
|
-
$.$mol_assert_equal($.$mol_conform(obj, null), obj);
|
|
6727
|
-
},
|
|
6728
|
-
'return target when some is undefined'() {
|
|
6729
|
-
const obj = { a: 1 };
|
|
6730
|
-
$.$mol_assert_equal($.$mol_conform(undefined, obj), undefined);
|
|
6731
|
-
$.$mol_assert_equal($.$mol_conform(obj, undefined), obj);
|
|
6732
|
-
},
|
|
6733
|
-
'return target when different keys count'() {
|
|
6734
|
-
const target = [1, 2, 3];
|
|
6735
|
-
const source = [1, 2, 3, undefined];
|
|
6736
|
-
const result = $.$mol_conform(target, source);
|
|
6737
|
-
$.$mol_assert_equal(result, target);
|
|
6738
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6739
|
-
},
|
|
6740
|
-
'return source when array values are strong equal'() {
|
|
6741
|
-
const source = [1, 2, 3];
|
|
6742
|
-
$.$mol_assert_equal($.$mol_conform([1, 2, 3], source), source);
|
|
6743
|
-
},
|
|
6744
|
-
'return source when object values are strong equal'() {
|
|
6745
|
-
const source = { a: 1, b: 2 };
|
|
6746
|
-
$.$mol_assert_equal($.$mol_conform({ a: 1, b: 2 }, source), source);
|
|
6747
|
-
},
|
|
6748
|
-
'return target when some values are not equal'() {
|
|
6749
|
-
const target = [1, 2, 3];
|
|
6750
|
-
const source = [1, 2, 5];
|
|
6751
|
-
const result = $.$mol_conform(target, source);
|
|
6752
|
-
$.$mol_assert_equal(result, target);
|
|
6753
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
6754
|
-
},
|
|
6755
|
-
'return source when values are deep equal'() {
|
|
6756
|
-
const source = { foo: { bar: 1 } };
|
|
6757
|
-
$.$mol_assert_equal($.$mol_conform({ foo: { bar: 1 } }, source), source);
|
|
6758
|
-
},
|
|
6759
|
-
'return target with equal values from source and not equal from target'() {
|
|
6760
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 2 } };
|
|
6761
|
-
const target = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6762
|
-
const result = $.$mol_conform(target, source);
|
|
6763
|
-
$.$mol_assert_equal(result, target);
|
|
6764
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6765
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6766
|
-
},
|
|
6767
|
-
'return target when equal but with different class'() {
|
|
6768
|
-
const target = { '0': 1 };
|
|
6769
|
-
$.$mol_assert_equal($.$mol_conform(target, [1]), target);
|
|
6770
|
-
},
|
|
6771
|
-
'return target when conformer for class is not defined'() {
|
|
6772
|
-
const Obj = class {
|
|
6773
|
-
};
|
|
6774
|
-
const source = new Obj;
|
|
6775
|
-
const target = new Obj;
|
|
6776
|
-
const result = $.$mol_conform(target, source);
|
|
6777
|
-
$.$mol_assert_equal(result, target);
|
|
6778
|
-
},
|
|
6779
|
-
'return target when has cyclic reference'() {
|
|
6780
|
-
const source = { foo: {} };
|
|
6781
|
-
source['self'] = source;
|
|
6782
|
-
const target = { foo: {} };
|
|
6783
|
-
target['self'] = target;
|
|
6784
|
-
const result = $.$mol_conform(target, source);
|
|
6785
|
-
$.$mol_assert_equal(result, target);
|
|
6786
|
-
$.$mol_assert_equal(result['self'], target);
|
|
6787
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6788
|
-
},
|
|
6789
|
-
'return source when equal dates'() {
|
|
6790
|
-
const source = new Date(12345);
|
|
6791
|
-
const target = new Date(12345);
|
|
6792
|
-
const result = $.$mol_conform(target, source);
|
|
6793
|
-
$.$mol_assert_equal(result, source);
|
|
6794
|
-
},
|
|
6795
|
-
'return source when equal regular expressions'() {
|
|
6796
|
-
const source = /\x22/mig;
|
|
6797
|
-
const target = /\x22/mig;
|
|
6798
|
-
const result = $.$mol_conform(target, source);
|
|
6799
|
-
$.$mol_assert_equal(result, source);
|
|
6800
|
-
},
|
|
6801
|
-
'return cached value if already conformed'() {
|
|
6802
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
6803
|
-
const target = { foo: { xxx: 2 }, bar: { xxx: 3 } };
|
|
6804
|
-
const result = $.$mol_conform(target, source);
|
|
6805
|
-
target.foo.xxx = 1;
|
|
6806
|
-
$.$mol_assert_equal($.$mol_conform(target.foo, source.foo), target.foo);
|
|
6807
|
-
},
|
|
6808
|
-
'skip readlony fields'() {
|
|
6809
|
-
const source = { foo: {}, bar: {} };
|
|
6810
|
-
const target = { foo: {}, bar: {} };
|
|
6811
|
-
Object.defineProperty(target, 'bar', { value: {}, writable: false });
|
|
6812
|
-
const result = $.$mol_conform(target, source);
|
|
6813
|
-
$.$mol_assert_equal(result, target);
|
|
6814
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
6815
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
6816
|
-
},
|
|
6817
|
-
'object with NaN'() {
|
|
6818
|
-
const source = { foo: Number.NaN };
|
|
6819
|
-
const target = { foo: Number.NaN };
|
|
6820
|
-
const result = $.$mol_conform(target, source);
|
|
6821
|
-
$.$mol_assert_equal(result, source);
|
|
6822
|
-
},
|
|
6823
|
-
'array with NaN'() {
|
|
6824
|
-
const source = [Number.NaN];
|
|
6825
|
-
const target = [Number.NaN];
|
|
6826
|
-
const result = $.$mol_conform(target, source);
|
|
6827
|
-
$.$mol_assert_equal(result, source);
|
|
6828
|
-
},
|
|
6829
|
-
});
|
|
6830
|
-
})($ || ($ = {}));
|
|
6831
|
-
//conform.test.js.map
|
|
6832
|
-
;
|
|
6833
|
-
"use strict";
|
|
6834
|
-
var $;
|
|
6835
6617
|
(function ($) {
|
|
6836
6618
|
$.$mol_test({
|
|
6837
6619
|
'trim array'() {
|
|
@@ -7474,92 +7256,6 @@ var $;
|
|
|
7474
7256
|
;
|
|
7475
7257
|
"use strict";
|
|
7476
7258
|
var $;
|
|
7477
|
-
(function ($) {
|
|
7478
|
-
$.$mol_test({
|
|
7479
|
-
'equal paths'() {
|
|
7480
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
7481
|
-
$.$mol_assert_like(diff, {
|
|
7482
|
-
prefix: [1, 2, 3, 4],
|
|
7483
|
-
suffix: [[], [], []],
|
|
7484
|
-
});
|
|
7485
|
-
},
|
|
7486
|
-
'different suffix'() {
|
|
7487
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
7488
|
-
$.$mol_assert_like(diff, {
|
|
7489
|
-
prefix: [1, 2],
|
|
7490
|
-
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
7491
|
-
});
|
|
7492
|
-
},
|
|
7493
|
-
'one contains other'() {
|
|
7494
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
7495
|
-
$.$mol_assert_like(diff, {
|
|
7496
|
-
prefix: [1, 2],
|
|
7497
|
-
suffix: [[3, 4], [], [3]],
|
|
7498
|
-
});
|
|
7499
|
-
},
|
|
7500
|
-
'fully different'() {
|
|
7501
|
-
const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
7502
|
-
$.$mol_assert_like(diff, {
|
|
7503
|
-
prefix: [],
|
|
7504
|
-
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
7505
|
-
});
|
|
7506
|
-
},
|
|
7507
|
-
});
|
|
7508
|
-
})($ || ($ = {}));
|
|
7509
|
-
//path.test.js.map
|
|
7510
|
-
;
|
|
7511
|
-
"use strict";
|
|
7512
|
-
var $;
|
|
7513
|
-
(function ($) {
|
|
7514
|
-
function $mol_diff_path(...paths) {
|
|
7515
|
-
const limit = Math.min(...paths.map(path => path.length));
|
|
7516
|
-
lookup: for (var i = 0; i < limit; ++i) {
|
|
7517
|
-
const first = paths[0][i];
|
|
7518
|
-
for (let j = 1; j < paths.length; ++j) {
|
|
7519
|
-
if (paths[j][i] !== first)
|
|
7520
|
-
break lookup;
|
|
7521
|
-
}
|
|
7522
|
-
}
|
|
7523
|
-
return {
|
|
7524
|
-
prefix: paths[0].slice(0, i),
|
|
7525
|
-
suffix: paths.map(path => path.slice(i)),
|
|
7526
|
-
};
|
|
7527
|
-
}
|
|
7528
|
-
$.$mol_diff_path = $mol_diff_path;
|
|
7529
|
-
})($ || ($ = {}));
|
|
7530
|
-
//path.js.map
|
|
7531
|
-
;
|
|
7532
|
-
"use strict";
|
|
7533
|
-
var $;
|
|
7534
|
-
(function ($) {
|
|
7535
|
-
class $mol_error_mix extends Error {
|
|
7536
|
-
errors;
|
|
7537
|
-
constructor(message, ...errors) {
|
|
7538
|
-
super(message);
|
|
7539
|
-
this.errors = errors;
|
|
7540
|
-
if (errors.length) {
|
|
7541
|
-
const stacks = [...errors.map(error => error.stack), this.stack];
|
|
7542
|
-
const diff = $.$mol_diff_path(...stacks.map(stack => {
|
|
7543
|
-
if (!stack)
|
|
7544
|
-
return [];
|
|
7545
|
-
return stack.split('\n').reverse();
|
|
7546
|
-
}));
|
|
7547
|
-
const head = diff.prefix.reverse().join('\n');
|
|
7548
|
-
const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
|
|
7549
|
-
this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
|
|
7550
|
-
this.message += errors.map(error => '\n' + error.message).join('');
|
|
7551
|
-
}
|
|
7552
|
-
}
|
|
7553
|
-
toJSON() {
|
|
7554
|
-
return this.message;
|
|
7555
|
-
}
|
|
7556
|
-
}
|
|
7557
|
-
$.$mol_error_mix = $mol_error_mix;
|
|
7558
|
-
})($ || ($ = {}));
|
|
7559
|
-
//mix.js.map
|
|
7560
|
-
;
|
|
7561
|
-
"use strict";
|
|
7562
|
-
var $;
|
|
7563
7259
|
(function ($) {
|
|
7564
7260
|
class $mol_view_tree_test_attributes_super extends $.$mol_view {
|
|
7565
7261
|
some() {
|