<commit_before>var MemoryStore = require('logux-core/memory-store')

var VERSION = '0'

function warn (message) {
  if (console && console.error) console.error(message)
}

function isQuotaExceeded (e) {
  if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {
    // Standard
    return true
  } else if (e.code === 1014 && e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
    // Firefox
    return true
  } else {
    return false
  }
}

/**
 * `localStorage` store for Logux log. It is based on `MemoryStore`
 * and serialize log to `localStorage` on every change.
 *
 * @param {string} [prefix="logux"] Prefix for `localStorage` key to has
 *                                  several Logux instances in one web page.
 *
 * @class
 * @extends Store
 */
function LocalStore (prefix) {
  if (typeof prefix === 'undefined') prefix = 'logux'

  /**
   * `localStorage` key name.
   * @type {string}
   */
  this.key = prefix + 'Log'

  this.memory = new MemoryStore()

  for (var i in this.memory) {
    var method = this.memory[i]
    if (typeof method === 'function' && typeof this[i] === 'undefined') {
      this[i] = method.bind(this.memory)
    }
  }

  this.checkLocalStorage()
  this.deserialize()
}

LocalStore.prototype = {

  add: function add () {
    var promise = this.memory.add.apply(this.memory, arguments)
    this.serialize()
    return promise
  },<commit_msg>Improve LocalStore JSDocs<commit_after>var MemoryStore = require('logux-core/memory-store')

var VERSION = '0'

function warn (message) {
  if (console && console.error) console.error(message)
}

function isQuotaExceeded (e) {
  if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {
    // Standard
    return true
  } else if (e.code === 1014 && e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
    // Firefox
    return true
  } else {
    return false
  }
}

/**
 * `localStorage` store for Logux log. It is based on `MemoryStore`
 * and serialize log to `localStorage` on every change.
 *
 * @param {string} [prefix="logux"] Prefix for `localStorage` key to run
 *                                  multiple Logux instances on same web page.
 *
 * @class
 * @extends Store
 *
 * @example
 * import LocalStore from 'logux-client/local-store'
 * const log = new Log({ store: new LocalStore(), timer }
 */
function LocalStore (prefix) {
  if (typeof prefix === 'undefined') prefix = 'logux'

  /**
   * `localStorage` key name.
   * @type {string}
   */
  this.key = prefix + 'Log'

  this.memory = new MemoryStore()

  for (var i in this.memory) {
    var method = this.memory[i]
    if (typeof method === 'function' && typeof this[i] === 'undefined') {
      this[i] = method.bind(this.memory)
    }
  }

  this.checkLocalStorage()
  this.deserialize()
}

LocalStore.prototype = {

  add: function add () {
    var promise = this.memory.add.apply(this.memory, arguments)
    this.serialize()
    return promise
  },
{'fraction_non_alphanumeric': 0.13917884481558804, 'fraction_numerical': 0.003479471120389701, 'mean_word_length': 2.93296853625171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2679462', 'n_tokens_mistral': 957, 'n_tokens_neox': 932, 'n_words': 257}