fetch breadcrumbs from api; button disabled support; component fix
This commit is contained in:
1 parent
26c03dfbbf
commit
aefa0ae2d4
9 files changed
+94
-50
No files matched your search
@@ -0,0 +1,22 @@
|
||||
export function splitBy(fn) {
|
||||
return items => {
|
||||
return items.reduce((acc, item) => {
|
||||
const key = fn(item)
|
||||
const items = acc.get(key) || []
|
||||
|
||||
return acc.set(key, [...items, item])
|
||||
}, new Map())
|
||||
}
|
||||
}
|
||||
|
||||
export function insertBetween<T, I = T>(items: T[], fn: (i: number) => I): Array<T | I> {
|
||||
return items.reduce((acc, x, i) => {
|
||||
acc.push(x)
|
||||
|
||||
if (i < items.length - 1) {
|
||||
acc.push(fn(i))
|
||||
}
|
||||
|
||||
return acc
|
||||
}, [])
|
||||
}
|
||||
Reference in new issue
Block a user