main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
773 bytes
|
Line | |
---|
1 | import assocIndexOf from './_assocIndexOf.js';
|
---|
2 |
|
---|
3 | /** Used for built-in method references. */
|
---|
4 | var arrayProto = Array.prototype;
|
---|
5 |
|
---|
6 | /** Built-in value references. */
|
---|
7 | var splice = arrayProto.splice;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Removes `key` and its value from the list cache.
|
---|
11 | *
|
---|
12 | * @private
|
---|
13 | * @name delete
|
---|
14 | * @memberOf ListCache
|
---|
15 | * @param {string} key The key of the value to remove.
|
---|
16 | * @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
---|
17 | */
|
---|
18 | function listCacheDelete(key) {
|
---|
19 | var data = this.__data__,
|
---|
20 | index = assocIndexOf(data, key);
|
---|
21 |
|
---|
22 | if (index < 0) {
|
---|
23 | return false;
|
---|
24 | }
|
---|
25 | var lastIndex = data.length - 1;
|
---|
26 | if (index == lastIndex) {
|
---|
27 | data.pop();
|
---|
28 | } else {
|
---|
29 | splice.call(data, index, 1);
|
---|
30 | }
|
---|
31 | --this.size;
|
---|
32 | return true;
|
---|
33 | }
|
---|
34 |
|
---|
35 | export default listCacheDelete;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.