-
-
Save codejockie/f65f958051c3641ce8cfa9c77803e530 to your computer and use it in GitHub Desktop.
Javascript flatMap implementation
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
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
Array.prototype.flatMap = function(lambda) { | |
return Array.prototype.concat.apply([], this.map(lambda)); | |
}; |
Author
codejockie
commented
Apr 8, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment