Created
July 25, 2016 03:34
-
-
Save andresmijares/7d1bfcb2a1441b61dd73812b26b0f3f1 to your computer and use it in GitHub Desktop.
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
function flatty(list) { | |
/*Pure function*/ | |
return list.reduce(function(all, item){ | |
return all.concat( | |
Array.isArray(item) ? flatty(item) : item | |
) | |
}, []) | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment