(no title)
renekooi | 10 years ago
function bindMap(fn) { return this.map(fn) }
[ 1, 2, 3 ]::bindMap(n => n + 1)
// standalone use: bindMap.call(arr, fn)
function pipelineMap(fn) { return arr => arr.map(fn) }
[ 1, 2, 3 ] |> pipelineMap(n => n + 1)
// standalone use: pipelineMap(fn)(arr)
(Also nice that it works in a very similar way to decorators, although they won't be interchangeable in most cases, with decorators working on class constructors and property descriptors, instead of just any value.)Presumably, at most one of these proposals will make it in :)
wycats|10 years ago
The main goal of all of these proposals is "left to right" composition when working with functions, and functions take parameters.