_hashGet.js 772 B

123456789101112131415161718192021222324252627282930
  1. var nativeCreate = require('./_nativeCreate');
  2. /** Used to stand-in for `undefined` hash values. */
  3. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4. /** Used for built-in method references. */
  5. var objectProto = Object.prototype;
  6. /** Used to check objects for own properties. */
  7. var hasOwnProperty = objectProto.hasOwnProperty;
  8. /**
  9. * Gets the hash value for `key`.
  10. *
  11. * @private
  12. * @name get
  13. * @memberOf Hash
  14. * @param {string} key The key of the value to get.
  15. * @returns {*} Returns the entry value.
  16. */
  17. function hashGet(key) {
  18. var data = this.__data__;
  19. if (nativeCreate) {
  20. var result = data[key];
  21. return result === HASH_UNDEFINED ? undefined : result;
  22. }
  23. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  24. }
  25. module.exports = hashGet;