time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

_hashGet.js (772B)


      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 = 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  * @name get
     17  * @memberOf Hash
     18  * @param {string} key The key of the value to get.
     19  * @returns {*} Returns the entry value.
     20  */
     21 function 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 
     30 module.exports = hashGet;