Lines Matching refs:func

9     var func = function(arg) { return 'name: ' + (this.name || arg); };  function
10 var bound = _.bind(func, context);
13 bound = _(func).bind(context);
16 bound = _.bind(func, null, 'curly');
21 func = function(salutation, name) { return salutation + ': ' + name; };
22 func = _.bind(func, this, 'hello');
23 assert.equal(func('moe'), 'hello: moe', 'the function was partially applied in advance');
25 func = _.bind(func, this, 'curly');
26 assert.equal(func(), 'hello: curly', 'the function was completely applied in advance');
28func = function(salutation, firstname, lastname) { return salutation + ': ' + firstname + ' ' + la…
29 func = _.bind(func, this, 'hello', 'moe', 'curly');
30 …assert.equal(func(), 'hello: moe curly', 'the function was partially applied in advance and can ac…
32 func = function(ctx, message) { assert.equal(this, ctx, message); };
33 _.bind(func, 0, 0, 'can bind a function to `0`')();
34 _.bind(func, '', '', 'can bind a function to an empty string')();
35 _.bind(func, false, false, 'can bind a function to `false`')();
52 var func = function() { return this.name + ' ' + _.toArray(arguments).join(' '); }; function
54 obj.func = _.partial(func, 'a', 'b');
55 assert.equal(obj.func('c', 'd'), 'moe a b c d', 'can partially apply');
57 obj.func = _.partial(func, _, 'b', _, 'd');
58 assert.equal(obj.func('a', 'c'), 'moe a b c d', 'can partially apply with placeholders');
60 func = _.partial(function() { return arguments.length; }, _, 'b', _, 'd');
61 assert.equal(func('a', 'c', 'e'), 5, 'accepts more arguments than the number of placeholders');
62 assert.equal(func('a'), 4, 'accepts fewer arguments than the number of placeholders');
64 func = _.partial(function() { return typeof arguments[2]; }, _, 'b', _, 'd');
65 assert.equal(func('a'), 'undefined', 'unfilled placeholders are undefined');
82 func = _.partial(function() { return arguments.length; }, obj, 'b', obj, 'd');
83 assert.equal(func('a'), 4, 'allows the placeholder to be swapped out');
86 func = _.partial(function() { return arguments.length; }, obj, 'b', obj, 'd');
87 assert.equal(func('a'), 5, 'swapping the placeholder preserves previously bound arguments');
602 …var backwards = _.wrap(greet, function(func, name){ return func(name) + ' ' + name.split('').rever… argument