Skip to content

Instantly share code, notes, and snippets.

@protomorph
Last active June 15, 2025 22:25
Show Gist options
  • Select an option

  • Save protomorph/581ffb4e7e694a80a02c28dede30f8d3 to your computer and use it in GitHub Desktop.

Select an option

Save protomorph/581ffb4e7e694a80a02c28dede30f8d3 to your computer and use it in GitHub Desktop.

Revisions

  1. protomorph revised this gist Jun 15, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion chunk.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    const chunk = (array, size) => array.map(
    (_, i) => i % size === 0 ? array.slice(i, i + size) : null
    ).filter(e => e)
    ).filter(Boolean)
  2. protomorph created this gist May 12, 2023.
    3 changes: 3 additions & 0 deletions chunk.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    const chunk = (array, size) => array.map(
    (_, i) => i % size === 0 ? array.slice(i, i + size) : null
    ).filter(e => e)