aboutsummaryrefslogtreecommitdiff
path: root/src/utils/arrays.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/arrays.ts')
-rw-r--r--src/utils/arrays.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/arrays.ts b/src/utils/arrays.ts
new file mode 100644
index 0000000..3961244
--- /dev/null
+++ b/src/utils/arrays.ts
@@ -0,0 +1,10 @@
+export const chunk = <T>(arr: T[], len: number) => {
+ const chunks = [];
+
+ let i = 0;
+ while (i < arr.length) {
+ chunks.push(arr.slice(i, i += len));
+ }
+
+ return chunks;
+};