UNPKG

559 BJavaScriptView Raw
1import Map from './_Map';
2import assocGet from './_assocGet';
3import hashGet from './_hashGet';
4import isKeyable from './_isKeyable';
5
6/**
7 * Gets the map value for `key`.
8 *
9 * @private
10 * @name get
11 * @memberOf MapCache
12 * @param {string} key The key of the value to get.
13 * @returns {*} Returns the entry value.
14 */
15function mapGet(key) {
16 var data = this.__data__;
17 if (isKeyable(key)) {
18 return hashGet(typeof key == 'string' ? data.string : data.hash, key);
19 }
20 return Map ? data.map.get(key) : assocGet(data.map, key);
21}
22
23export default mapGet;