Skip to content

Instantly share code, notes, and snippets.

View AWilco's full-sized avatar

Alex Wilkinson AWilco

View GitHub Profile
@AWilco
AWilco / flatMap.js
Created September 7, 2016 12:14 — forked from samgiles/flatMap.js
Javascript flatMap implementation
// [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
}
});