00001 var ListCache = require('./_ListCache'), 00002 Map = require('./_Map'), 00003 MapCache = require('./_MapCache'); 00004 00006 var LARGE_ARRAY_SIZE = 200; 00007 00018 function stackSet(key, value) { 00019 var data = this.__data__; 00020 if (data instanceof ListCache) { 00021 var pairs = data.__data__; 00022 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 00023 pairs.push([key, value]); 00024 this.size = ++data.size; 00025 return this; 00026 } 00027 data = this.__data__ = new MapCache(pairs); 00028 } 00029 data.set(key, value); 00030 this.size = data.size; 00031 return this; 00032 } 00033 00034 module.exports = stackSet;