25ced97b794aeaa04e69a3ee2c800345741f4caa
[yaffs-website] / node_modules / uncss / node_modules / lodash / internal / Stack.js
1 var stackClear = require('./stackClear'),
2     stackDelete = require('./stackDelete'),
3     stackGet = require('./stackGet'),
4     stackHas = require('./stackHas'),
5     stackSet = require('./stackSet');
6
7 /**
8  * Creates a stack cache object to store key-value pairs.
9  *
10  * @private
11  * @param {Array} [values] The values to cache.
12  */
13 function Stack(values) {
14   var index = -1,
15       length = values ? values.length : 0;
16
17   this.clear();
18   while (++index < length) {
19     var entry = values[index];
20     this.set(entry[0], entry[1]);
21   }
22 }
23
24 // Add functions to the `Stack` cache.
25 Stack.prototype.clear = stackClear;
26 Stack.prototype['delete'] = stackDelete;
27 Stack.prototype.get = stackGet;
28 Stack.prototype.has = stackHas;
29 Stack.prototype.set = stackSet;
30
31 module.exports = Stack;