mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Avoid setting arity/processing args if func is not passed to methods like _.bind.
This commit is contained in:
24
lodash.js
24
lodash.js
@@ -4598,10 +4598,12 @@
|
|||||||
if (arguments.length < 3) {
|
if (arguments.length < 3) {
|
||||||
return createWrapper(func, BIND_FLAG, null, thisArg);
|
return createWrapper(func, BIND_FLAG, null, thisArg);
|
||||||
}
|
}
|
||||||
var arity = func && (func[expando] ? func[expando][2] : func.length),
|
if (func) {
|
||||||
partialArgs = slice(arguments, 2);
|
var arity = func[expando] ? func[expando][2] : func.length,
|
||||||
|
partialArgs = slice(arguments, 2);
|
||||||
|
|
||||||
arity -= partialArgs.length;
|
arity -= partialArgs.length;
|
||||||
|
}
|
||||||
return createWrapper(func, BIND_FLAG | PARTIAL_FLAG, arity, thisArg, partialArgs);
|
return createWrapper(func, BIND_FLAG | PARTIAL_FLAG, arity, thisArg, partialArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5071,10 +5073,12 @@
|
|||||||
* // => 'hi fred'
|
* // => 'hi fred'
|
||||||
*/
|
*/
|
||||||
function partial(func) {
|
function partial(func) {
|
||||||
var arity = func && (func[expando] ? func[expando][2] : func.length),
|
if (func) {
|
||||||
partialArgs = slice(arguments, 1);
|
var arity = func[expando] ? func[expando][2] : func.length,
|
||||||
|
partialArgs = slice(arguments, 1);
|
||||||
|
|
||||||
arity -= partialArgs.length;
|
arity -= partialArgs.length;
|
||||||
|
}
|
||||||
return createWrapper(func, PARTIAL_FLAG, arity, null, partialArgs);
|
return createWrapper(func, PARTIAL_FLAG, arity, null, partialArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5109,10 +5113,12 @@
|
|||||||
* // => { '_': _, 'jq': $ }
|
* // => { '_': _, 'jq': $ }
|
||||||
*/
|
*/
|
||||||
function partialRight(func) {
|
function partialRight(func) {
|
||||||
var arity = func && (func[expando] ? func[expando][2] : func.length),
|
if (func) {
|
||||||
partialRightArgs = slice(arguments, 1);
|
var arity = func[expando] ? func[expando][2] : func.length,
|
||||||
|
partialRightArgs = slice(arguments, 1);
|
||||||
|
|
||||||
arity -= partialRightArgs.length;
|
arity -= partialRightArgs.length;
|
||||||
|
}
|
||||||
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
|
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user