'use strict';

var _listCacheClear = require('./_listCacheClear.js');
var _listCacheDelete = require('./_listCacheDelete.js');
var _listCacheGet = require('./_listCacheGet.js');
var _listCacheHas = require('./_listCacheHas.js');
var _listCacheSet = require('./_listCacheSet.js');

/**
 * Creates an list cache object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function ListCache(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 `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;

module.exports = ListCache;
