qmwts 1.1.79 → 1.1.80
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.
|
@@ -30,7 +30,7 @@ declare const _default: {
|
|
|
30
30
|
* @param override 遇到重复元素是否覆盖
|
|
31
31
|
*/
|
|
32
32
|
uniqueByKey<T, K = unknown>(array: T[] | undefined, value: (item: T) => K, override?: boolean): T[];
|
|
33
|
-
sort<T>(array: T[], order: "asc" | "desc", ...values: ((item: T) =>
|
|
33
|
+
sort<T>(array: T[], order: "asc" | "desc", ...values: ((item: T) => any)[]): void;
|
|
34
34
|
mergeByKey<T extends object>(keyExtractor: (item: T) => string | number | symbol, ...arrays: T[][]): T[];
|
|
35
35
|
};
|
|
36
36
|
export default _default;
|
|
@@ -112,6 +112,8 @@ exports.default = {
|
|
|
112
112
|
for (const fn of values) {
|
|
113
113
|
const valueA = fn(a);
|
|
114
114
|
const valueB = fn(b);
|
|
115
|
+
if (typeof valueA === 'string' && typeof valueB === 'string')
|
|
116
|
+
return valueA.localeCompare(valueB) * multiplier;
|
|
115
117
|
if (valueA - valueB !== 0)
|
|
116
118
|
return (valueA - valueB) * multiplier;
|
|
117
119
|
}
|