Skip to content

Commit 5bf34f8

Browse files
committed
Create split_by_count.ts
1 parent b4c5d41 commit 5bf34f8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

utils/split_by_count.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { group } from "../deps.ts";
2+
3+
export function split_by_count<T>(files: T[], limit: number) {
4+
return Object.values(
5+
group(
6+
files,
7+
(_s: any, i: number) => i % Math.floor(files.length / limit)
8+
)
9+
) as T[][];
10+
}

0 commit comments

Comments
 (0)