1 var isObject = require('../lang/isObject');
4 * Checks if `value` is in `cache` mimicking the return signature of
5 * `_.indexOf` by returning `0` if the value is found, else `-1`.
8 * @param {Object} cache The cache to search.
9 * @param {*} value The value to search for.
10 * @returns {number} Returns `0` if `value` is found, else `-1`.
12 function cacheIndexOf(cache, value) {
13 var data = cache.data,
14 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
16 return result ? 0 : -1;
19 module.exports = cacheIndexOf;