UNPKG

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