Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
553 bytes
|
Line | |
---|
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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.