_Stack.js 732 B

123456789101112131415161718192021222324252627
  1. import ListCache from './_ListCache.js';
  2. import stackClear from './_stackClear.js';
  3. import stackDelete from './_stackDelete.js';
  4. import stackGet from './_stackGet.js';
  5. import stackHas from './_stackHas.js';
  6. import stackSet from './_stackSet.js';
  7. /**
  8. * Creates a stack cache object to store key-value pairs.
  9. *
  10. * @private
  11. * @constructor
  12. * @param {Array} [entries] The key-value pairs to cache.
  13. */
  14. function Stack(entries) {
  15. var data = this.__data__ = new ListCache(entries);
  16. this.size = data.size;
  17. }
  18. // Add methods to `Stack`.
  19. Stack.prototype.clear = stackClear;
  20. Stack.prototype['delete'] = stackDelete;
  21. Stack.prototype.get = stackGet;
  22. Stack.prototype.has = stackHas;
  23. Stack.prototype.set = stackSet;
  24. export default Stack;