mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Simplify getFuncName.
This commit is contained in:
@@ -1046,14 +1046,6 @@
|
||||
*/
|
||||
support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
|
||||
|
||||
/**
|
||||
* Detect if `Function#name` is supported (all but IE).
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.funcNames = typeof Function.name == 'string';
|
||||
|
||||
/**
|
||||
* Detect if the `toStringTag` of DOM nodes is resolvable (all but IE < 9).
|
||||
*
|
||||
@@ -4043,29 +4035,20 @@
|
||||
* @param {Function} func The function to query.
|
||||
* @returns {string} Returns the function name.
|
||||
*/
|
||||
var getFuncName = (function() {
|
||||
if (!support.funcNames) {
|
||||
return constant('');
|
||||
}
|
||||
if (constant.name == 'constant') {
|
||||
return baseProperty('name');
|
||||
}
|
||||
return function(func) {
|
||||
var result = func.name,
|
||||
array = realNames[result],
|
||||
length = array ? array.length : 0;
|
||||
function getFuncName(func) {
|
||||
var result = func.name,
|
||||
array = realNames[result],
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (length--) {
|
||||
var data = array[length],
|
||||
otherFunc = data.func;
|
||||
|
||||
if (otherFunc == null || otherFunc == func) {
|
||||
return data.name;
|
||||
}
|
||||
while (length--) {
|
||||
var data = array[length],
|
||||
otherFunc = data.func;
|
||||
if (otherFunc == null || otherFunc == func) {
|
||||
return data.name;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
|
||||
|
||||
Reference in New Issue
Block a user