_hashHas.js 626 B

1234567891011121314151617181920212223
  1. var nativeCreate = require('./_nativeCreate');
  2. /** Used for built-in method references. */
  3. var objectProto = Object.prototype;
  4. /** Used to check objects for own properties. */
  5. var hasOwnProperty = objectProto.hasOwnProperty;
  6. /**
  7. * Checks if a hash value for `key` exists.
  8. *
  9. * @private
  10. * @name has
  11. * @memberOf Hash
  12. * @param {string} key The key of the entry to check.
  13. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14. */
  15. function hashHas(key) {
  16. var data = this.__data__;
  17. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  18. }
  19. module.exports = hashHas;