extract InsertBetweenFunction type

This commit is contained in:
tmshv committed 2022-09-06 13:06:24 +03:00
1 parent 73a9635129
commit ccd34ec7f8
1 file changed
+2 -1
+2 -1
View File
@@ -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) => {
acc.push(x)