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.
28 lines
575 B
28 lines
575 B
9 years ago
|
var isKeyable = require('./_isKeyable');
|
||
|
|
||
|
/** Used to stand-in for `undefined` hash values. */
|
||
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||
|
|
||
|
/**
|
||
|
* Adds `value` to the set cache.
|
||
|
*
|
||
|
* @private
|
||
|
* @name push
|
||
|
* @memberOf SetCache
|
||
|
* @param {*} value The value to cache.
|
||
|
*/
|
||
|
function cachePush(value) {
|
||
|
var map = this.__data__;
|
||
|
if (isKeyable(value)) {
|
||
|
var data = map.__data__,
|
||
|
hash = typeof value == 'string' ? data.string : data.hash;
|
||
|
|
||
|
hash[value] = HASH_UNDEFINED;
|
||
|
}
|
||
|
else {
|
||
|
map.set(value, HASH_UNDEFINED);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = cachePush;
|