'use strict';

class MemStorage {
  // #region fields
  _data = {};
  // #endregion
  // #region properties
  get length() {
    return Object.keys(this._data).length;
  }
  // #endregion
  // #region constructor
  constructor() {
    this._data = {};
  }
  // #endregion
  // #region methods
  getItem(key) {
    return this._data[key] || null;
  }
  setItem(key, value) {
    this._data[key] = value;
  }
  removeItem(key) {
    delete this._data[key];
  }
  key(index) {
    return Object.keys(this._data)[index] || null;
  }
  clear() {
    this._data = {};
  }
  // #endregion
}

exports.MemStorage = MemStorage;
