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