1 | import MapCache from './_MapCache';
|
2 | import cachePush from './_cachePush';
|
3 |
|
4 | /**
|
5 | *
|
6 | * Creates a set cache object to store unique values.
|
7 | *
|
8 | * @private
|
9 | * @constructor
|
10 | * @param {Array} [values] The values to cache.
|
11 | */
|
12 | function SetCache(values) {
|
13 | var index = -1,
|
14 | length = values ? values.length : 0;
|
15 |
|
16 | this.__data__ = new MapCache;
|
17 | while (++index < length) {
|
18 | this.push(values[index]);
|
19 | }
|
20 | }
|
21 |
|
22 | // Add methods to `SetCache`.
|
23 | SetCache.prototype.push = cachePush;
|
24 |
|
25 | export default SetCache;
|