mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Bump to v3.0.0.
This commit is contained in:
19
internal/cacheIndexOf.js
Normal file
19
internal/cacheIndexOf.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import isObject from '../lang/isObject';
|
||||
|
||||
/**
|
||||
* Checks if `value` is in `cache` mimicking the return signature of
|
||||
* `_.indexOf` by returning `0` if the value is found, else `-1`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} cache The cache to search.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns `0` if `value` is found, else `-1`.
|
||||
*/
|
||||
function cacheIndexOf(cache, value) {
|
||||
var data = cache.data,
|
||||
result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
|
||||
|
||||
return result ? 0 : -1;
|
||||
}
|
||||
|
||||
export default cacheIndexOf;
|
||||
Reference in New Issue
Block a user