qmwts 1.1.80 → 1.1.82
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const lodash_es_1 = require("lodash-es");
|
|
4
|
+
const number_utils_1 = require("./number-utils");
|
|
4
5
|
exports.default = {
|
|
5
6
|
/**
|
|
6
7
|
* 数组转化为树形结构
|
|
@@ -112,10 +113,15 @@ exports.default = {
|
|
|
112
113
|
for (const fn of values) {
|
|
113
114
|
const valueA = fn(a);
|
|
114
115
|
const valueB = fn(b);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
let result = 0;
|
|
117
|
+
if (number_utils_1.default.isNumber(valueA) && number_utils_1.default.isNumber(valueB)) {
|
|
118
|
+
result = valueA - valueB;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
result = String(valueA).localeCompare(String(valueB));
|
|
122
|
+
}
|
|
123
|
+
if (result !== 0)
|
|
124
|
+
return result * multiplier;
|
|
119
125
|
}
|
|
120
126
|
return 0;
|
|
121
127
|
});
|