Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

_ListCache.js 869B

1234567891011121314151617181920212223242526272829303132
  1. var listCacheClear = require('./_listCacheClear'),
  2. listCacheDelete = require('./_listCacheDelete'),
  3. listCacheGet = require('./_listCacheGet'),
  4. listCacheHas = require('./_listCacheHas'),
  5. listCacheSet = require('./_listCacheSet');
  6. /**
  7. * Creates an list cache object.
  8. *
  9. * @private
  10. * @constructor
  11. * @param {Array} [entries] The key-value pairs to cache.
  12. */
  13. function ListCache(entries) {
  14. var index = -1,
  15. length = entries == null ? 0 : entries.length;
  16. this.clear();
  17. while (++index < length) {
  18. var entry = entries[index];
  19. this.set(entry[0], entry[1]);
  20. }
  21. }
  22. // Add methods to `ListCache`.
  23. ListCache.prototype.clear = listCacheClear;
  24. ListCache.prototype['delete'] = listCacheDelete;
  25. ListCache.prototype.get = listCacheGet;
  26. ListCache.prototype.has = listCacheHas;
  27. ListCache.prototype.set = listCacheSet;
  28. module.exports = ListCache;