Fixes #409 - Unexpected arguments passed to wrapper function in _.wrap when the first argument of calling the wrapper function is an array

This commit is contained in:
Bob Remeika
2011-12-20 01:51:51 -08:00
parent b4a38439ce
commit 5ca27ffed1
2 changed files with 6 additions and 2 deletions

View File

@@ -163,6 +163,11 @@ $(document).ready(function() {
var obj = {name : "Moe"};
obj.hi = _.wrap(inner, function(fn){ return fn() + this.name; });
equals(obj.hi(), "Hello Moe");
var noop = function(){};
var wrapped = _.wrap(noop, function(fn){ return Array.prototype.slice.call(arguments, 0); });
var ret = wrapped(['whats', 'your'], 'vector', 'victor');
same(ret, [noop, ['whats', 'your'], 'vector', 'victor']);
});
test("functions: compose", function() {