Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

shoeb shoebsd31

:octocat:
View GitHub Profile
@shoebsd31
shoebsd31 / flatMap.js
Created Dec 21, 2017 — forked from samgiles/flatMap.js
Javascript flatMap implementation
View flatMap.js
// [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));
};