Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / cacheIndexOf.js
1 var isObject = require('../lang/isObject');
2
3 /**
4  * Checks if `value` is in `cache` mimicking the return signature of
5  * `_.indexOf` by returning `0` if the value is found, else `-1`.
6  *
7  * @private
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`.
11  */
12 function cacheIndexOf(cache, value) {
13   var data = cache.data,
14       result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
15
16   return result ? 0 : -1;
17 }
18
19 module.exports = cacheIndexOf;