Break out repository and relay

This commit is contained in:
Jon Staab
2024-05-03 17:25:27 -07:00
parent 4a1d61dd99
commit f96bee686e
4 changed files with 222 additions and 207 deletions
+12
View File
@@ -130,6 +130,18 @@ export const ensurePlural = <T>(x: T | T[]) => (x instanceof Array ? x : [x])
export const ensureNumber = (x: number | string) => parseFloat(x as string)
export const fromPairs = <T>(pairs: [k?: string, v?: T, ...args: unknown[]][]) => {
const r: Record<string, T> = {}
for (const [k, v] of pairs) {
if (k && v) {
r[k] = v
}
}
return r
}
export const flatten = <T>(xs: T[][]) => xs.flatMap(identity)
export const partition = <T>(f: (x: T) => boolean, xs: T[]) => {