7a587861eae6f0f4ac75e3aa86e901e1dbb26868
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / _mapSet.js
1 var Map = require('./_Map'),
2     assocSet = require('./_assocSet'),
3     hashSet = require('./_hashSet'),
4     isKeyable = require('./_isKeyable');
5
6 /**
7  * Sets the map `key` to `value`.
8  *
9  * @private
10  * @name set
11  * @memberOf MapCache
12  * @param {string} key The key of the value to set.
13  * @param {*} value The value to set.
14  * @returns {Object} Returns the map cache object.
15  */
16 function mapSet(key, value) {
17   var data = this.__data__;
18   if (isKeyable(key)) {
19     hashSet(typeof key == 'string' ? data.string : data.hash, key, value);
20   } else if (Map) {
21     data.map.set(key, value);
22   } else {
23     assocSet(data.map, key, value);
24   }
25   return this;
26 }
27
28 module.exports = mapSet;