1 | import isKeyable from './_isKeyable';
|
2 |
|
3 | /** Used to stand-in for `undefined` hash values. */
|
4 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
5 |
|
6 | /**
|
7 | * Adds `value` to the set cache.
|
8 | *
|
9 | * @private
|
10 | * @name push
|
11 | * @memberOf SetCache
|
12 | * @param {*} value The value to cache.
|
13 | */
|
14 | function cachePush(value) {
|
15 | var map = this.__data__;
|
16 | if (isKeyable(value)) {
|
17 | var data = map.__data__,
|
18 | hash = typeof value == 'string' ? data.string : data.hash;
|
19 |
|
20 | hash[value] = HASH_UNDEFINED;
|
21 | }
|
22 | else {
|
23 | map.set(value, HASH_UNDEFINED);
|
24 | }
|
25 | }
|
26 |
|
27 | export default cachePush;
|