Files
lodash/_stackSet.js
John-David Dalton 35cdf6513b Bump to v4.13.0.
2016-05-22 19:35:24 -07:00

27 lines
679 B
JavaScript

import ListCache from './_ListCache.js';
import MapCache from './_MapCache.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
cache = this.__data__ = new MapCache(cache.__data__);
}
cache.set(key, value);
return this;
}
export default stackSet;