1 | import Map from './_Map';
|
2 | import assocDelete from './_assocDelete';
|
3 | import hashDelete from './_hashDelete';
|
4 | import isKeyable from './_isKeyable';
|
5 |
|
6 | /**
|
7 | * Removes `key` and its value from the map.
|
8 | *
|
9 | * @private
|
10 | * @name delete
|
11 | * @memberOf MapCache
|
12 | * @param {string} key The key of the value to remove.
|
13 | * @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
14 | */
|
15 | function mapDelete(key) {
|
16 | var data = this.__data__;
|
17 | if (isKeyable(key)) {
|
18 | return hashDelete(typeof key == 'string' ? data.string : data.hash, key);
|
19 | }
|
20 | return Map ? data.map['delete'](key) : assocDelete(data.map, key);
|
21 | }
|
22 |
|
23 | export default mapDelete;
|