_getMapData.js 400 B

123456789101112131415161718
  1. var isKeyable = require('./_isKeyable');
  2. /**
  3. * Gets the data for `map`.
  4. *
  5. * @private
  6. * @param {Object} map The map to query.
  7. * @param {string} key The reference key.
  8. * @returns {*} Returns the map data.
  9. */
  10. function getMapData(map, key) {
  11. var data = map.__data__;
  12. return isKeyable(key)
  13. ? data[typeof key == 'string' ? 'string' : 'hash']
  14. : data.map;
  15. }
  16. module.exports = getMapData;