UNPKG

minter-js-sdk

Version:
34 lines (29 loc) 906 B
'use strict'; var _mapCacheClear = require('./_mapCacheClear.js'); var _mapCacheDelete = require('./_mapCacheDelete.js'); var _mapCacheGet = require('./_mapCacheGet.js'); var _mapCacheHas = require('./_mapCacheHas.js'); var _mapCacheSet = require('./_mapCacheSet.js'); /** * 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 == null ? 0 : entries.length; 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; module.exports = MapCache;