Permalink
Browse files

add alias for Curry and remove implementation

  • Loading branch information...
1 parent 3b15daf commit 38deb664c7ab3f7cdb0726193c1639ac020bcc42 @lvivski committed Feb 15, 2012
Showing with 1 addition and 16 deletions.
  1. +0 −5 test/functions.js
  2. +1 −11 underscore.js
View
@@ -209,11 +209,6 @@ $(document).ready(function() {
equal(testAfter(0, 0), 1, "after(0) should fire immediately");
});
- test("function: curry", function() {
- var curriedMin = _.curry(Math.min, 2, 3, 4, -1);
- equal(curriedMin(-5, -7), -7, "min() should be called with the whole set of arguments");
- });
-
asyncTest("functions: partial", 2, function() {
var delayed = false;
var partialTimeout = _.partial(setTimeout, undefined, 100);
View
@@ -476,7 +476,7 @@
// optionally). Binding with arguments is also known as `curry`.
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
// We check for `func.bind` first, to fail fast when `func` is undefined.
- _.bind = function bind(func, context) {
+ _.bind = _.curry = function bind(func, context) {
var bound, args;
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
@@ -606,16 +606,6 @@
};
};
- // Transforms a function that takes multiple arguments in such a way it
- // can be called with initial set of arguments and then called with the rest
- // of the arguments.
- _.curry = function(func) {
- var args = slice.call(arguments, 1);
- return function() {
- return func.apply(this, args.concat(slice.call(arguments, 0)));
- };
- };
-
// Transforms a function that takes multiple arguments in such a wat it can
// be called with initial set of arguments, setting "undefined" for arguments
// we don't need now, and he called with the rest of arguments.

0 comments on commit 38deb66

Please sign in to comment.