artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
_stackSet.js
1 var ListCache = require('./_ListCache'),
2  Map = require('./_Map'),
3  MapCache = require('./_MapCache');
4 
6 var LARGE_ARRAY_SIZE = 200;
7 
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;
25  return this;
26  }
27  data = this.__data__ = new MapCache(pairs);
28  }
29  data.set(key, value);
30  this.size = data.size;
31  return this;
32 }
33 
34 module.exports = stackSet;