Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
598 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var nativeCreate = require('./_nativeCreate');
|
---|
| 2 |
|
---|
| 3 | /** Used to stand-in for `undefined` hash values. */
|
---|
| 4 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Sets the hash `key` to `value`.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @name set
|
---|
| 11 | * @memberOf Hash
|
---|
| 12 | * @param {string} key The key of the value to set.
|
---|
| 13 | * @param {*} value The value to set.
|
---|
| 14 | * @returns {Object} Returns the hash instance.
|
---|
| 15 | */
|
---|
| 16 | function hashSet(key, value) {
|
---|
| 17 | var data = this.__data__;
|
---|
| 18 | this.size += this.has(key) ? 0 : 1;
|
---|
| 19 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
---|
| 20 | return this;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | module.exports = hashSet;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.