35f343184bfcd02e49c5f2ab2efe657ca00fa4fff5db576c4933e6743558e9157609b2d74562f20f6ce9736c01a585e8789b2f612e17e0056bf38a781e0ac4 553 B

1234567891011121314151617181920212223242526
  1. var assocIndexOf = require('./_assocIndexOf');
  2. /**
  3. * Sets the list cache `key` to `value`.
  4. *
  5. * @private
  6. * @name set
  7. * @memberOf ListCache
  8. * @param {string} key The key of the value to set.
  9. * @param {*} value The value to set.
  10. * @returns {Object} Returns the list cache instance.
  11. */
  12. function listCacheSet(key, value) {
  13. var data = this.__data__,
  14. index = assocIndexOf(data, key);
  15. if (index < 0) {
  16. ++this.size;
  17. data.push([key, value]);
  18. } else {
  19. data[index][1] = value;
  20. }
  21. return this;
  22. }
  23. module.exports = listCacheSet;