Skip to content

Instantly share code, notes, and snippets.

@boton
Created May 29, 2018 16:48
Show Gist options
  • Select an option

  • Save boton/dd244b67ccca35c46d85c0da6b2d4c23 to your computer and use it in GitHub Desktop.

Select an option

Save boton/dd244b67ccca35c46d85c0da6b2d4c23 to your computer and use it in GitHub Desktop.
Array flatten
// borrowed from https://gist.github.com/Integralist/749153aa53fea7168e7e#gistcomment-1457123
const flatten = list => list.reduce(
(accumulator, element) => accumulator.concat(Array.isArray(element)
? flatten(element)
: element),
[]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment