Improve relay validation and add sort function

This commit is contained in:
Jon Staab
2024-05-24 08:53:36 -07:00
parent c5e3f6d5a4
commit 5ec54e3204
4 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -207,8 +207,10 @@ export const uniqBy = <T>(f: (x: T) => any, xs: T[]) => {
return r
}
export const sort = <T>(xs: T[]) => [...xs].sort()
export const sortBy = <T>(f: (x: T) => number, xs: T[]) =>
xs.sort((a: T, b: T) => f(a) - f(b))
[...xs].sort((a: T, b: T) => f(a) - f(b))
export const groupBy = <T, K>(f: (x: T) => K, xs: T[]) => {
const r = new Map<K, T[]>()