Urara-Blog/node_modules/.pnpm-store/v3/files/dc/cc8ef764c40c987ccf380a78f93068f5c86f640b53b628dd3a45b9fe7c542f8a880245fd9a1d6fbf34b8c3ccabcd1e6a59c2d68dbd132ca17615c2639bdcca
2022-08-14 01:14:53 +08:00

23 lines
660 B
Text

/**
* This function is like `baseIndexOf` except that it accepts a comparator.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @param {Function} comparator The comparator invoked per element.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
}
module.exports = baseIndexOfWith;