UNPKG

772 BJavaScriptView Raw
1var nativeCreate = require('./_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 * @name get
17 * @memberOf Hash
18 * @param {string} key The key of the value to get.
19 * @returns {*} Returns the entry value.
20 */
21function hashGet(key) {
22 var data = this.__data__;
23 if (nativeCreate) {
24 var result = data[key];
25 return result === HASH_UNDEFINED ? undefined : result;
26 }
27 return hasOwnProperty.call(data, key) ? data[key] : undefined;
28}
29
30module.exports = hashGet;