mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Optimize createBindWrapper, createPartialWrapper, and createHybridWrapper.
This commit is contained in:
@@ -3213,7 +3213,8 @@
|
|||||||
var Ctor = createCtorWrapper(func);
|
var Ctor = createCtorWrapper(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(thisArg, arguments);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -3416,7 +3417,8 @@
|
|||||||
if (isAry && ary < args.length) {
|
if (isAry && ary < args.length) {
|
||||||
args.length = ary;
|
args.length = ary;
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? (Ctor || createCtorWrapper(func)) : func).apply(thisBinding, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
|
||||||
|
return fn.apply(thisBinding, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -3475,7 +3477,8 @@
|
|||||||
while (argsLength--) {
|
while (argsLength--) {
|
||||||
args[leftIndex++] = arguments[++argsIndex];
|
args[leftIndex++] = arguments[++argsIndex];
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(isBind ? thisArg : this, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user