array.ts (hoppscotch-2.2.1) | : | array.ts (hoppscotch-3.0.0) | ||
---|---|---|---|---|
import clone from "lodash/clone" | import { clone } from "lodash-es" | |||
/** | /** | |||
* Sorts the array based on the sort func. | * Sorts the array based on the sort func. | |||
* NOTE: Creates a new array, if you don't need ref | * NOTE: Creates a new array, if you don't need ref | |||
* to original array, use `arrayUnsafeSort` for better perf | * to original array, use `arrayUnsafeSort` for better perf | |||
* @param sortFunc Sort function to sort against | * @param sortFunc Sort function to sort against | |||
*/ | */ | |||
export const arraySort = | export const arraySort = | |||
<T>(sortFunc: (a: T, b: T) => number) => | <T>(sortFunc: (a: T, b: T) => number) => | |||
(arr: T[]) => { | (arr: T[]) => { | |||
const newArr = clone(arr) | const newArr = clone(arr) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |