Skip to content

Instantly share code, notes, and snippets.

@shoebsd31
Forked from samgiles/flatMap.js
Created December 21, 2017 15:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Javascript flatMap implementation
// [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));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment