Add mapDelete.

This commit is contained in:
John-David Dalton
2014-11-28 13:47:38 -08:00
parent fb9118a044
commit ab3b972185
2 changed files with 42 additions and 8 deletions

View File

@@ -1445,6 +1445,19 @@
this.__data__ = {};
}
/**
* Removes `key` and its value from the cache.
*
* @private
* @name get
* @memberOf _.memoize.Cache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
*/
function mapDelete(key) {
return delete this.__data__[key];
}
/**
* Gets the cached value for `key`.
*
@@ -9970,6 +9983,7 @@
LodashWrapper.prototype = lodash.prototype;
// Add functions to the `Map` cache.
MapCache.prototype['delete'] = mapDelete;
MapCache.prototype.get = mapGet;
MapCache.prototype.has = mapHas;
MapCache.prototype.set = mapSet;