Last active
March 9, 2018 01:55
-
-
Save szanata/8d634242c4ecde3c1c950f278f6867ef to your computer and use it in GitHub Desktop.
JS Flatten functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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