Closed rstacruz closed 8 years ago
This has been discussed over and over, both here and in ESDiscuss. Please read previous issues before opening new ones. https://github.com/zenparsing/es-function-bind/issues/19
In your case:
function take (count) { return this.substr(0, count) }
function reverse () { return this.split("").reverse().join(""); /* yours was broken*/ }
Etc.
this
is something that is mostly used in cases of prototypal inheritance, which is somewhat counter-intuitive to functional-programming-like approaches.Instead of
a::b()
passinga
asthis
to theb()
function, why not pass it as the first parameter? that is:This is something that exists in elixir as the pipe operator.