ut2 1.3.1 → 1.3.2
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/README.md +2 -4
- package/dist/ut2.js +21 -37
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/internals/compare.js +8 -26
- package/es/internals/helpers.js +1 -1
- package/es/isEqual.js +12 -10
- package/lib/internals/compare.js +8 -26
- package/lib/internals/helpers.js +1 -1
- package/lib/isEqual.js +12 -10
- package/package.json +1 -1
- package/types/isBuffer.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# ut2
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
一个现代 JavaScript 实用工具库。
|
|
3
|
+
一个现代 JavaScript 实用工具库。[点击查看在线文档]。
|
|
6
4
|
|
|
7
|
-
[
|
|
5
|
+
[![npm][npm]][npm-url] [](https://github.com/caijf/ut2/actions/workflows/ci.yml) [](https://codecov.io/gh/caijf/ut2)  
|
|
8
6
|
|
|
9
7
|
## 比较
|
|
10
8
|
|
package/dist/ut2.js
CHANGED
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
var numberIsSafeInteger = Number.isSafeInteger;
|
|
282
282
|
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
283
283
|
var arrayAt = arrayProto.at;
|
|
284
|
-
var VERSION = "1.3.
|
|
284
|
+
var VERSION = "1.3.2";
|
|
285
285
|
|
|
286
286
|
function isFunction(value) {
|
|
287
287
|
if (!isObject(value)) {
|
|
@@ -494,21 +494,12 @@
|
|
|
494
494
|
function compareAsc(value, other) {
|
|
495
495
|
var valueIsSymbol = isSymbol(value);
|
|
496
496
|
var otherIsSymbol = isSymbol(other);
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if (valueIsSymbol) {
|
|
501
|
-
return 1;
|
|
502
|
-
}
|
|
503
|
-
if (otherIsSymbol) {
|
|
504
|
-
return -1;
|
|
505
|
-
}
|
|
506
|
-
var valStr = toString(value);
|
|
507
|
-
var othStr = toString(other);
|
|
508
|
-
if (valStr > othStr) {
|
|
497
|
+
var valueStr = toString(value);
|
|
498
|
+
var otherStr = toString(other);
|
|
499
|
+
if (!otherIsSymbol && (valueIsSymbol || valueStr > otherStr)) {
|
|
509
500
|
return 1;
|
|
510
501
|
}
|
|
511
|
-
if (
|
|
502
|
+
if (!valueIsSymbol && (otherIsSymbol || valueStr < otherStr)) {
|
|
512
503
|
return -1;
|
|
513
504
|
}
|
|
514
505
|
return 0;
|
|
@@ -516,21 +507,12 @@
|
|
|
516
507
|
function compareDesc(value, other) {
|
|
517
508
|
var valueIsSymbol = isSymbol(value);
|
|
518
509
|
var otherIsSymbol = isSymbol(other);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (valueIsSymbol) {
|
|
510
|
+
var valueStr = toString(value);
|
|
511
|
+
var otherStr = toString(other);
|
|
512
|
+
if (!otherIsSymbol && (valueIsSymbol || valueStr > otherStr)) {
|
|
523
513
|
return -1;
|
|
524
514
|
}
|
|
525
|
-
if (otherIsSymbol) {
|
|
526
|
-
return 1;
|
|
527
|
-
}
|
|
528
|
-
var valStr = toString(value);
|
|
529
|
-
var othStr = toString(other);
|
|
530
|
-
if (valStr > othStr) {
|
|
531
|
-
return -1;
|
|
532
|
-
}
|
|
533
|
-
if (valStr < othStr) {
|
|
515
|
+
if (!valueIsSymbol && (otherIsSymbol || valueStr < otherStr)) {
|
|
534
516
|
return 1;
|
|
535
517
|
}
|
|
536
518
|
return 0;
|
|
@@ -1010,13 +992,14 @@
|
|
|
1010
992
|
if (hasCustomizer) {
|
|
1011
993
|
var compared = customizer(value[length], other[length], length, value, other, valueStack, otherStack);
|
|
1012
994
|
if (compared !== undefined) {
|
|
1013
|
-
|
|
1014
|
-
|
|
995
|
+
if (!compared) {
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
continue;
|
|
1015
999
|
}
|
|
1016
1000
|
}
|
|
1017
1001
|
if (!isEqualDeep(value[length], other[length], customizer, strictCheck, valueStack, otherStack)) {
|
|
1018
|
-
|
|
1019
|
-
break;
|
|
1002
|
+
return false;
|
|
1020
1003
|
}
|
|
1021
1004
|
}
|
|
1022
1005
|
}
|
|
@@ -1032,23 +1015,24 @@
|
|
|
1032
1015
|
if (hasCustomizer) {
|
|
1033
1016
|
var compared = customizer(value[key], other[key], key, value, other, valueStack, otherStack);
|
|
1034
1017
|
if (compared !== undefined) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1018
|
+
if (!compared) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
continue;
|
|
1037
1022
|
}
|
|
1038
1023
|
}
|
|
1039
1024
|
if (!(hasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
|
|
1040
|
-
|
|
1041
|
-
break;
|
|
1025
|
+
return false;
|
|
1042
1026
|
}
|
|
1043
1027
|
if (!skipCtor && key === 'constructor') {
|
|
1044
1028
|
skipCtor = true;
|
|
1045
1029
|
}
|
|
1046
1030
|
}
|
|
1047
|
-
if (
|
|
1031
|
+
if (!skipCtor) {
|
|
1048
1032
|
var valCtor = value.constructor;
|
|
1049
1033
|
var othCtor = other.constructor;
|
|
1050
1034
|
if (valCtor !== othCtor && !(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) && 'constructor' in value && 'constructor' in other) {
|
|
1051
|
-
|
|
1035
|
+
return false;
|
|
1052
1036
|
}
|
|
1053
1037
|
}
|
|
1054
1038
|
}
|