4 ms·
Prototype has curry() and bind() methods on functions for some time. http://prototypejs.org/api/function http://prototypejs.org/api/function String.prototype.
by ilyak 17y ago
Prototype has curry() and bind() methods on functions for some time.
http://prototypejs.org/api/function http://prototypejs.org/api/function
String.prototype.splitOnSpaces = String.prototype.split.curry(" ");
"foo bar baz thud".splitOnSpaces(); //-> ["foo", "bar", "baz", "thud"]
- lhorie 17y agoThis: "foo bar baz thud".splitOnSpaces(); //-> ["foo", "bar", "baz", "thud"] can be written like this: $w("foo bar baz thud")