Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Wilkinson AWilco

View GitHub Profile
@AWilco
AWilco / flatMap.js
Created Sep 7, 2016 — 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 (:
Object.defineProperties(Array.prototype, {
'flatMap': {
value: function (lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
},
writeable: false,
enumerable: false
}
});