extract InsertBetweenFunction type
This commit is contained in:
1 parent
73a9635129
commit
ccd34ec7f8
1 file changed
+2
-1
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
|
export type InsertBetweenFunction<T> = (i: number) => T
|
||||||
|
|
||||||
export function insertBetween<T, I = T>(items: T[], fn: (i: number) => I): Array<T | I> {
|
export function insertBetween<T, I = T>(items: T[], fn: InsertBetweenFunction<I>): Array<T | I> {
|
||||||
return items.reduce<Array<T | I>>((acc, x, i) => {
|
return items.reduce<Array<T | I>>((acc, x, i) => {
|
||||||
acc.push(x)
|
acc.push(x)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user