Urara-Blog/node_modules/.pnpm-store/v3/files/d9/8821edee3d63e473df621dd0671f26da18ae197ffae14e62048bd1ca07b5515f4e4dee4b105ee5a2db3f3026e330aad12765374a2bdaaaa127cbf19542564d
2022-08-14 01:14:53 +08:00

23 lines
747 B
Text

/**
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
* without support for iteratee shorthands, which iterates over `collection`
* using `eachFunc`.
*
* @private
* @param {Array|Object} collection The collection to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = key;
return false;
}
});
return result;
}
module.exports = baseFindKey;