main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
551 bytes
|
Line | |
---|
1 | import assocIndexOf from './_assocIndexOf.js';
|
---|
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 | export default listCacheSet;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.