mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Move switch optimization to negate.
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -437,8 +437,7 @@
|
||||
* @returns {*} Returns the result of `func`.
|
||||
*/
|
||||
function apply(func, thisArg, args) {
|
||||
var length = args.length;
|
||||
switch (length) {
|
||||
switch (args.length) {
|
||||
case 0: return func.call(thisArg);
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
@@ -10105,7 +10104,14 @@
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
return function() {
|
||||
return !predicate.apply(this, arguments);
|
||||
var args = arguments;
|
||||
switch (args.length) {
|
||||
case 0: return !predicate.call(this);
|
||||
case 1: return !predicate.call(this, args[0]);
|
||||
case 2: return !predicate.call(this, args[0], args[1]);
|
||||
case 3: return !predicate.call(this, args[0], args[1], args[2]);
|
||||
}
|
||||
return !predicate.apply(this, args);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user