@newdash/newdash
Version:
javascript/typescript utility library
57 lines (56 loc) • 1.52 kB
TypeScript
export default MapCache;
declare class MapCache {
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
private constructor();
/**
* Removes all key-value entries from the map.
*
* @memberOf MapCache
*/
clear(): void;
size: number;
__data__: {
hash: any;
map: Map<any, any>;
string: any;
};
/**
* Removes `key` and its value from the map.
*
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
delete(key: string): boolean;
/**
* Gets the map value for `key`.
*
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
get(key: string): any;
/**
* Checks if a map value for `key` exists.
*
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
has(key: string): boolean;
/**
* Sets the map `key` to `value`.
*
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
set(key: string, value: any): any;
}