8348fa654a830c62382d1fa152aecddcf846bcca
[yaffs-website] / hashHas.js
1 var nativeCreate = require('./nativeCreate');
2
3 /** Used for built-in method references. */
4 var objectProto = global.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  * @param {Object} hash The hash to query.
14  * @param {string} key The key of the entry to check.
15  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
16  */
17 function hashHas(hash, key) {
18   return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key);
19 }
20
21 module.exports = hashHas;