Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
489 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var 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 | */
|
---|
| 13 | function 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 |
|
---|
| 22 | module.exports = mapCacheSet;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.