mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
658 B
25 lines
658 B
var isKeyable = require('./_isKeyable');
|
|
|
|
/** Used to stand-in for `undefined` hash values. */
|
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
|
|
/**
|
|
* Checks if `value` is in `cache`.
|
|
*
|
|
* @private
|
|
* @param {Object} cache The set cache to search.
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
*/
|
|
function cacheHas(cache, value) {
|
|
var map = cache.__data__;
|
|
if (isKeyable(value)) {
|
|
var data = map.__data__,
|
|
hash = typeof value == 'string' ? data.string : data.hash;
|
|
|
|
return hash[value] === HASH_UNDEFINED;
|
|
}
|
|
return map.has(value);
|
|
}
|
|
|
|
module.exports = cacheHas;
|
|
|