Last active
March 30, 2018 17:24
-
-
Save vampyar/8806c092cba92ef946b4bdb2340bfb2e to your computer and use it in GitHub Desktop.
customFlatten
This file contains 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
const customFlatten = (arr) => { | |
return arr.reduce((initFlat, toFlat) => { | |
return initFlat.concat(Array.isArray(toFlat) ? customFlatten(toFlat) : toFlat); | |
}, []) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment