mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Bump to v4.12.0.
This commit is contained in:
20
_stackSet.js
20
_stackSet.js
@@ -1,4 +1,4 @@
|
||||
define(['./_MapCache', './_assocSet'], function(MapCache, assocSet) {
|
||||
define(['./_ListCache', './_MapCache'], function(ListCache, MapCache) {
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
@@ -14,21 +14,11 @@ define(['./_MapCache', './_assocSet'], function(MapCache, assocSet) {
|
||||
* @returns {Object} Returns the stack cache instance.
|
||||
*/
|
||||
function stackSet(key, value) {
|
||||
var data = this.__data__,
|
||||
array = data.array;
|
||||
|
||||
if (array) {
|
||||
if (array.length < (LARGE_ARRAY_SIZE - 1)) {
|
||||
assocSet(array, key, value);
|
||||
} else {
|
||||
data.array = null;
|
||||
data.map = new MapCache(array);
|
||||
}
|
||||
}
|
||||
var map = data.map;
|
||||
if (map) {
|
||||
map.set(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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user