ismx-nexo-node-app 0.4.161 → 0.4.162
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.
|
@@ -146,9 +146,9 @@ class ArrayUtils {
|
|
|
146
146
|
static sortedBy(array, key, sortFn = 'desc') {
|
|
147
147
|
let valueFn = typeof key === 'function' ? key : (t) => t[key];
|
|
148
148
|
if (sortFn === 'desc')
|
|
149
|
-
return ArrayUtils.sorted(array, (a, b) => valueFn(a) - valueFn(b));
|
|
150
|
-
if (sortFn === 'asc')
|
|
151
149
|
return ArrayUtils.sorted(array, (a, b) => valueFn(b) - valueFn(a));
|
|
150
|
+
if (sortFn === 'asc')
|
|
151
|
+
return ArrayUtils.sorted(array, (a, b) => valueFn(a) - valueFn(b));
|
|
152
152
|
else
|
|
153
153
|
return array;
|
|
154
154
|
}
|
package/package.json
CHANGED
|
@@ -139,8 +139,8 @@ export default abstract class ArrayUtils {
|
|
|
139
139
|
*/
|
|
140
140
|
static sortedBy<T>(array: T[], key: keyof T | ((t: T) => number), sortFn: 'asc' | 'desc' = 'desc'): T[] {
|
|
141
141
|
let valueFn: (t: T) => number = typeof key === 'function' ? key : (t) => t[key] as number;
|
|
142
|
-
if (sortFn === 'desc') return ArrayUtils.sorted(array, (a, b) => valueFn(
|
|
143
|
-
if (sortFn === 'asc') return ArrayUtils.sorted(array, (a, b) => valueFn(
|
|
142
|
+
if (sortFn === 'desc') return ArrayUtils.sorted(array, (a, b) => valueFn(b) - valueFn(a));
|
|
143
|
+
if (sortFn === 'asc') return ArrayUtils.sorted(array, (a, b) => valueFn(a) - valueFn(b));
|
|
144
144
|
else return array;
|
|
145
145
|
}
|
|
146
146
|
}
|