mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
24 lines
569 B
JavaScript
24 lines
569 B
JavaScript
var Map = require('./Map'),
|
|
assocGet = require('./assocGet'),
|
|
hashGet = require('./hashGet'),
|
|
isKeyable = require('./isKeyable');
|
|
|
|
/**
|
|
* Gets the map value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function mapGet(key) {
|
|
var data = this.__data__;
|
|
if (isKeyable(key)) {
|
|
return hashGet(typeof key == 'string' ? data.string : data.hash, key);
|
|
}
|
|
return Map ? data.map.get(key) : assocGet(data.map, key);
|
|
}
|
|
|
|
module.exports = mapGet;
|