Files
lodash/_MapCache.js
John-David Dalton 07c844053e Bump to v4.12.0.
2016-05-08 12:23:20 -07:00

33 lines
844 B
JavaScript

import mapCacheClear from './_mapCacheClear';
import mapCacheDelete from './_mapCacheDelete';
import mapCacheGet from './_mapCacheGet';
import mapCacheHas from './_mapCacheHas';
import mapCacheSet from './_mapCacheSet';
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
export default MapCache;