SIGN IN SIGN UP

A modern JavaScript utility library delivering modularity, performance, & extras.

0 0 9 JavaScript
2016-05-07 11:49:46 -07:00
define(['./_MapCache', './_setCacheAdd', './_setCacheHas'], function(MapCache, setCacheAdd, setCacheHas) {
2015-01-08 00:37:01 -08:00
/**
*
2016-05-07 11:49:46 -07:00
* Creates an array cache object to store unique values.
2015-01-08 00:37:01 -08:00
*
* @private
2016-02-15 20:20:54 -08:00
* @constructor
2015-01-08 00:37:01 -08:00
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
2015-12-16 17:53:20 -08:00
var index = -1,
2016-10-30 20:06:57 -07:00
length = values == null ? 0 : values.length;
2015-01-08 00:37:01 -08:00
2015-12-16 17:53:20 -08:00
this.__data__ = new MapCache;
while (++index < length) {
2016-05-07 11:49:46 -07:00
this.add(values[index]);
2015-01-08 00:37:01 -08:00
}
}
2016-03-26 00:00:01 -07:00
// Add methods to `SetCache`.
2016-05-07 11:49:46 -07:00
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
2015-01-08 00:37:01 -08:00
return SetCache;
});