12345678910111213141516171819202122232425262728
  1. var MapCache = require('./_MapCache'),
  2. setCacheAdd = require('./_setCacheAdd'),
  3. setCacheHas = require('./_setCacheHas');
  4. /**
  5. *
  6. * Creates an array 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 == null ? 0 : values.length;
  15. this.__data__ = new MapCache;
  16. while (++index < length) {
  17. this.add(values[index]);
  18. }
  19. }
  20. // Add methods to `SetCache`.
  21. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  22. SetCache.prototype.has = setCacheHas;
  23. module.exports = SetCache;