8
0

mapHas.js 607 B

1234567891011121314151617181920212223
  1. import Map from './Map';
  2. import assocHas from './assocHas';
  3. import hashHas from './hashHas';
  4. import isKeyable from './isKeyable';
  5. /**
  6. * Checks if a map value for `key` exists.
  7. *
  8. * @private
  9. * @name has
  10. * @memberOf MapCache
  11. * @param {string} key The key of the entry to check.
  12. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13. */
  14. function mapHas(key) {
  15. var data = this.__data__;
  16. if (isKeyable(key)) {
  17. return hashHas(typeof key == 'string' ? data.string : data.hash, key);
  18. }
  19. return Map ? data.map.has(key) : assocHas(data.map, key);
  20. }
  21. export default mapHas;