ba605030de57a7bd1e5ca9042560e2c49f3387aa
[yaffs-website] / hashGet.js
1 var nativeCreate = require('./nativeCreate');
2
3 /** Used to stand-in for `undefined` hash values. */
4 var HASH_UNDEFINED = '__lodash_hash_undefined__';
5
6 /** Used for built-in method references. */
7 var objectProto = global.Object.prototype;
8
9 /** Used to check objects for own properties. */
10 var 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  */
20 function 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
28 module.exports = hashGet;