* An implementation of `_.contains` for cache objects that mimics the return * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. * * @private * @param {Object} cache The cache object to inspect. * @param {*} value The value to search for. * @returns {numbe
(cache, value)
| 35323 | * @returns {number} Returns `0` if `value` is found, else `-1`. |
| 35324 | */ |
| 35325 | function cacheIndexOf(cache, value) { |
| 35326 | var type = typeof value; |
| 35327 | cache = cache.cache; |
| 35328 | |
| 35329 | if (type == 'boolean' || value == null) { |
| 35330 | return cache[value] ? 0 : -1; |
| 35331 | } |
| 35332 | if (type != 'number' && type != 'string') { |
| 35333 | type = 'object'; |
| 35334 | } |
| 35335 | var key = type == 'number' ? value : keyPrefix + value; |
| 35336 | cache = (cache = cache[type]) && cache[key]; |
| 35337 | |
| 35338 | return type == 'object' |
| 35339 | ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) |
| 35340 | : (cache ? 0 : -1); |
| 35341 | } |
| 35342 | |
| 35343 | /** |
| 35344 | * Adds a given value to the corresponding cache object. |
no test coverage detected