_Stack.js 734B

12345678910111213141516171819202122232425262728
  1. var ListCache = require('./_ListCache'),
  2. stackClear = require('./_stackClear'),
  3. stackDelete = require('./_stackDelete'),
  4. stackGet = require('./_stackGet'),
  5. stackHas = require('./_stackHas'),
  6. stackSet = require('./_stackSet');
  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. module.exports = Stack;