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
508 B
25 lines
508 B
var MapCache = require('./_MapCache'),
|
|
cachePush = require('./_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 methods to `SetCache`.
|
|
SetCache.prototype.push = cachePush;
|
|
|
|
module.exports = SetCache;
|
|
|