'use strict';

var _hashClear = require('./_hashClear.js');
var _hashDelete = require('./_hashDelete.js');
var _hashGet = require('./_hashGet.js');
var _hashHas = require('./_hashHas.js');
var _hashSet = require('./_hashSet.js');

/**
 * Creates a hash object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function Hash(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 `Hash`.
Hash.prototype.clear = _hashClear;
Hash.prototype['delete'] = _hashDelete;
Hash.prototype.get = _hashGet;
Hash.prototype.has = _hashHas;
Hash.prototype.set = _hashSet;

module.exports = Hash;
