1/** 2 * lodash 3.0.2 (Custom Build) <https://lodash.com/> 3 * Build: `lodash modern modularize exports="npm" -o ./` 4 * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> 5 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 6 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 7 * Available under MIT license <https://lodash.com/license> 8 */ 9 10/** 11 * Checks if `value` is in `cache` mimicking the return signature of 12 * `_.indexOf` by returning `0` if the value is found, else `-1`. 13 * 14 * @private 15 * @param {Object} cache The cache to search. 16 * @param {*} value The value to search for. 17 * @returns {number} Returns `0` if `value` is found, else `-1`. 18 */ 19function cacheIndexOf(cache, value) { 20 var data = cache.data, 21 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; 22 23 return result ? 0 : -1; 24} 25 26/** 27 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. 28 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 29 * 30 * @static 31 * @memberOf _ 32 * @category Lang 33 * @param {*} value The value to check. 34 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 35 * @example 36 * 37 * _.isObject({}); 38 * // => true 39 * 40 * _.isObject([1, 2, 3]); 41 * // => true 42 * 43 * _.isObject(1); 44 * // => false 45 */ 46function isObject(value) { 47 // Avoid a V8 JIT bug in Chrome 19-20. 48 // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. 49 var type = typeof value; 50 return !!value && (type == 'object' || type == 'function'); 51} 52 53module.exports = cacheIndexOf; 54