mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Add Stack#clear.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -1933,13 +1933,24 @@
|
||||
var index = -1,
|
||||
length = values ? values.length : 0;
|
||||
|
||||
this.__data__ = { 'array': [], 'map': null };
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = values[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the stack.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf Stack
|
||||
*/
|
||||
function stackClear() {
|
||||
this.__data__ = { 'array': [], 'map': null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the stack.
|
||||
*
|
||||
@@ -13802,6 +13813,7 @@
|
||||
SetCache.prototype.push = cachePush;
|
||||
|
||||
// Add functions to the `Stack` cache.
|
||||
Stack.prototype.clear = stackClear;
|
||||
Stack.prototype['delete'] = stackDelete;
|
||||
Stack.prototype.get = stackGet;
|
||||
Stack.prototype.has = stackHas;
|
||||
|
||||
Reference in New Issue
Block a user