UNPKG

489 BJavaScriptView Raw
1var getMapData = require('./_getMapData');
2
3/**
4 * Sets the map `key` to `value`.
5 *
6 * @private
7 * @name set
8 * @memberOf MapCache
9 * @param {string} key The key of the value to set.
10 * @param {*} value The value to set.
11 * @returns {Object} Returns the map cache instance.
12 */
13function mapCacheSet(key, value) {
14 var data = getMapData(this, key),
15 size = data.size;
16
17 data.set(key, value);
18 this.size += data.size == size ? 0 : 1;
19 return this;
20}
21
22module.exports = mapCacheSet;