mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v4.1.0.
This commit is contained in:
28
_hashGet.js
Normal file
28
_hashGet.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var nativeCreate = require('./_nativeCreate');
|
||||
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = global.Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Gets the hash value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} hash The hash to query.
|
||||
* @param {string} key The key of the value to get.
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
function hashGet(hash, key) {
|
||||
if (nativeCreate) {
|
||||
var result = hash[key];
|
||||
return result === HASH_UNDEFINED ? undefined : result;
|
||||
}
|
||||
return hasOwnProperty.call(hash, key) ? hash[key] : undefined;
|
||||
}
|
||||
|
||||
module.exports = hashGet;
|
||||
Reference in New Issue
Block a user