ut2 1.3.0 → 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 +26 -38
- 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 +12 -26
- package/es/internals/helpers.js +1 -1
- package/es/isEqual.js +13 -11
- package/lib/internals/compare.js +12 -26
- package/lib/internals/helpers.js +1 -1
- package/lib/isEqual.js +13 -11
- 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)) {
|
|
@@ -492,41 +492,27 @@
|
|
|
492
492
|
}
|
|
493
493
|
|
|
494
494
|
function compareAsc(value, other) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
var valueIsSymbol = isSymbol(value);
|
|
496
|
+
var otherIsSymbol = isSymbol(other);
|
|
497
|
+
var valueStr = toString(value);
|
|
498
|
+
var otherStr = toString(other);
|
|
499
|
+
if (!otherIsSymbol && (valueIsSymbol || valueStr > otherStr)) {
|
|
499
500
|
return 1;
|
|
500
501
|
}
|
|
501
|
-
if (
|
|
502
|
-
return -1;
|
|
503
|
-
}
|
|
504
|
-
var valStr = toString(value);
|
|
505
|
-
var othStr = toString(other);
|
|
506
|
-
if (valStr > othStr) {
|
|
507
|
-
return 1;
|
|
508
|
-
}
|
|
509
|
-
if (valStr < othStr) {
|
|
502
|
+
if (!valueIsSymbol && (otherIsSymbol || valueStr < otherStr)) {
|
|
510
503
|
return -1;
|
|
511
504
|
}
|
|
512
505
|
return 0;
|
|
513
506
|
}
|
|
514
507
|
function compareDesc(value, other) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
if (isSymbol(other)) {
|
|
522
|
-
return 1;
|
|
523
|
-
}
|
|
524
|
-
var valStr = toString(value);
|
|
525
|
-
var othStr = toString(other);
|
|
526
|
-
if (valStr > othStr) {
|
|
508
|
+
var valueIsSymbol = isSymbol(value);
|
|
509
|
+
var otherIsSymbol = isSymbol(other);
|
|
510
|
+
var valueStr = toString(value);
|
|
511
|
+
var otherStr = toString(other);
|
|
512
|
+
if (!otherIsSymbol && (valueIsSymbol || valueStr > otherStr)) {
|
|
527
513
|
return -1;
|
|
528
514
|
}
|
|
529
|
-
if (
|
|
515
|
+
if (!valueIsSymbol && (otherIsSymbol || valueStr < otherStr)) {
|
|
530
516
|
return 1;
|
|
531
517
|
}
|
|
532
518
|
return 0;
|
|
@@ -898,7 +884,7 @@
|
|
|
898
884
|
map.forEach(function (value, key) {
|
|
899
885
|
result.push([key, value]);
|
|
900
886
|
});
|
|
901
|
-
return orderBy(result,
|
|
887
|
+
return orderBy(result, [0, 1]);
|
|
902
888
|
}
|
|
903
889
|
function setToArray(set) {
|
|
904
890
|
var result = [];
|
|
@@ -1006,13 +992,14 @@
|
|
|
1006
992
|
if (hasCustomizer) {
|
|
1007
993
|
var compared = customizer(value[length], other[length], length, value, other, valueStack, otherStack);
|
|
1008
994
|
if (compared !== undefined) {
|
|
1009
|
-
|
|
1010
|
-
|
|
995
|
+
if (!compared) {
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
continue;
|
|
1011
999
|
}
|
|
1012
1000
|
}
|
|
1013
1001
|
if (!isEqualDeep(value[length], other[length], customizer, strictCheck, valueStack, otherStack)) {
|
|
1014
|
-
|
|
1015
|
-
break;
|
|
1002
|
+
return false;
|
|
1016
1003
|
}
|
|
1017
1004
|
}
|
|
1018
1005
|
}
|
|
@@ -1028,23 +1015,24 @@
|
|
|
1028
1015
|
if (hasCustomizer) {
|
|
1029
1016
|
var compared = customizer(value[key], other[key], key, value, other, valueStack, otherStack);
|
|
1030
1017
|
if (compared !== undefined) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1018
|
+
if (!compared) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
continue;
|
|
1033
1022
|
}
|
|
1034
1023
|
}
|
|
1035
1024
|
if (!(hasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
|
|
1036
|
-
|
|
1037
|
-
break;
|
|
1025
|
+
return false;
|
|
1038
1026
|
}
|
|
1039
1027
|
if (!skipCtor && key === 'constructor') {
|
|
1040
1028
|
skipCtor = true;
|
|
1041
1029
|
}
|
|
1042
1030
|
}
|
|
1043
|
-
if (
|
|
1031
|
+
if (!skipCtor) {
|
|
1044
1032
|
var valCtor = value.constructor;
|
|
1045
1033
|
var othCtor = other.constructor;
|
|
1046
1034
|
if (valCtor !== othCtor && !(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) && 'constructor' in value && 'constructor' in other) {
|
|
1047
|
-
|
|
1035
|
+
return false;
|
|
1048
1036
|
}
|
|
1049
1037
|
}
|
|
1050
1038
|
}
|