_hashSet.js 560 B

12345678910111213141516171819202122
  1. var nativeCreate = require('./_nativeCreate');
  2. /** Used to stand-in for `undefined` hash values. */
  3. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4. /**
  5. * Sets the hash `key` to `value`.
  6. *
  7. * @private
  8. * @name set
  9. * @memberOf Hash
  10. * @param {string} key The key of the value to set.
  11. * @param {*} value The value to set.
  12. * @returns {Object} Returns the hash instance.
  13. */
  14. function hashSet(key, value) {
  15. var data = this.__data__;
  16. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  17. return this;
  18. }
  19. module.exports = hashSet;