Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / internal / stackSet.js
1 var MapCache = require('./MapCache'),
2     assocSet = require('./assocSet');
3
4 /** Used as the size to enable large array optimizations. */
5 var LARGE_ARRAY_SIZE = 200;
6
7 /**
8  * Sets the stack `key` to `value`.
9  *
10  * @private
11  * @name set
12  * @memberOf Stack
13  * @param {string} key The key of the value to set.
14  * @param {*} value The value to set.
15  * @returns {Object} Returns the stack cache object.
16  */
17 function stackSet(key, value) {
18   var data = this.__data__,
19       array = data.array;
20
21   if (array) {
22     if (array.length < (LARGE_ARRAY_SIZE - 1)) {
23       assocSet(array, key, value);
24     } else {
25       data.array = null;
26       data.map = new MapCache(array);
27     }
28   }
29   var map = data.map;
30   if (map) {
31     map.set(key, value);
32   }
33   return this;
34 }
35
36 module.exports = stackSet;