Skip to content

Instantly share code, notes, and snippets.

@szanata
Last active March 9, 2018 01:55
Show Gist options
  • Save szanata/8d634242c4ecde3c1c950f278f6867ef to your computer and use it in GitHub Desktop.
Save szanata/8d634242c4ecde3c1c950f278f6867ef to your computer and use it in GitHub Desktop.
JS Flatten functions
// Ultra slim flat func
const flat = ( a=[] ) => a.reduce( ( a, v ) => a.concat( v.map ? flat(v) : v ), [] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment