You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
598 B

4 years ago
  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. this.size += this.has(key) ? 0 : 1;
  17. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  18. return this;
  19. }
  20. module.exports = hashSet;