Skip to content

Instantly share code, notes, and snippets.

@metoikos
Created March 25, 2020 11:01
Show Gist options
  • Save metoikos/86afe747973c07559872d4bba04d1d6f to your computer and use it in GitHub Desktop.
Save metoikos/86afe747973c07559872d4bba04d1d6f to your computer and use it in GitHub Desktop.

Revisions

  1. metoikos created this gist Mar 25, 2020.
    3 changes: 3 additions & 0 deletions chunk.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    const chunk = (arr: any, size: number) => Array.from({
    length: Math.ceil(arr.length, size)
    }, (v: any, i: any) => arr.slice(i * size, i * size + size))