mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 22:47:50 +00:00
24 lines
627 B
JavaScript
24 lines
627 B
JavaScript
/**
|
|
* A specialized version of `_.includesWith` for arrays without support for
|
|
* specifying an index to search from.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to search.
|
|
* @param {*} target The value to search for.
|
|
* @param {Function} comparator The comparator invoked per element.
|
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
*/
|
|
function arrayIncludesWith(array, value, comparator) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
if (comparator(value, array[index])) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
export default arrayIncludesWith;
|