mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
26 lines
506 B
JavaScript
26 lines
506 B
JavaScript
import MapCache from './_MapCache';
|
|
import cachePush from './_cachePush';
|
|
|
|
/**
|
|
*
|
|
* Creates a set cache object to store unique values.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [values] The values to cache.
|
|
*/
|
|
function SetCache(values) {
|
|
var index = -1,
|
|
length = values ? values.length : 0;
|
|
|
|
this.__data__ = new MapCache;
|
|
while (++index < length) {
|
|
this.push(values[index]);
|
|
}
|
|
}
|
|
|
|
// Add functions to the `SetCache`.
|
|
SetCache.prototype.push = cachePush;
|
|
|
|
export default SetCache;
|