time-to-botec

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

_hashHas.js (626B)


      1 var nativeCreate = require('./_nativeCreate');
      2 
      3 /** Used for built-in method references. */
      4 var objectProto = Object.prototype;
      5 
      6 /** Used to check objects for own properties. */
      7 var hasOwnProperty = objectProto.hasOwnProperty;
      8 
      9 /**
     10  * Checks if a hash value for `key` exists.
     11  *
     12  * @private
     13  * @name has
     14  * @memberOf Hash
     15  * @param {string} key The key of the entry to check.
     16  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
     17  */
     18 function hashHas(key) {
     19   var data = this.__data__;
     20   return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
     21 }
     22 
     23 module.exports = hashHas;