UNPKG

643 BJavaScriptView Raw
1import Map from './_Map';
2import assocDelete from './_assocDelete';
3import hashDelete from './_hashDelete';
4import 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 */
15function 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
23export default mapDelete;