Skip to content

Instantly share code, notes, and snippets.

@shoebsd31
Forked from samgiles/flatMap.js
Created Dec 21, 2017
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