mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Optimize _.callback.
This commit is contained in:
@@ -6977,8 +6977,9 @@
|
||||
*/
|
||||
function createCallback(func, thisArg, argCount) {
|
||||
var type = typeof func;
|
||||
if (func == null || type == 'function') {
|
||||
return baseCreateCallback(func, thisArg, argCount);
|
||||
if (type == 'function' || func == null) {
|
||||
return (typeof thisArg == 'undefined' || !('prototype' in func)) &&
|
||||
func || baseCreateCallback(func, thisArg, argCount);
|
||||
}
|
||||
// handle "_.pluck" and "_.where" style callback shorthands
|
||||
return type != 'object' ? property(func) : match(func);
|
||||
|
||||
Reference in New Issue
Block a user