1 var ListCache = require('./_ListCache'),
2 Map = require('./_Map'),
3 MapCache = require('./_MapCache');
5 /** Used as the size to enable large array optimizations. */
6 var LARGE_ARRAY_SIZE = 200;
9 * Sets the stack `key` to `value`.
14 * @param {string} key The key of the value to set.
15 * @param {*} value The value to set.
16 * @returns {Object} Returns the stack cache instance.
18 function stackSet(key, value) {
19 var data = this.__data__;
20 if (data instanceof ListCache) {
21 var pairs = data.__data__;
22 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
23 pairs.push([key, value]);
24 this.size = ++data.size;
27 data = this.__data__ = new MapCache(pairs);
30 this.size = data.size;
34 module.exports = stackSet;