mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
28 lines
702 B
JavaScript
28 lines
702 B
JavaScript
import nativeCreate from './_nativeCreate.js';
|
|
|
|
/** Used to stand-in for `undefined` hash values. */
|
|
const HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
|
|
/** Used to check objects for own properties. */
|
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
|
/**
|
|
* Gets the hash value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function hashGet(key) {
|
|
const data = this.__data__;
|
|
if (nativeCreate) {
|
|
const result = data[key];
|
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
}
|
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
}
|
|
|
|
export default hashGet;
|