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