HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/vorpal/dist/local-storage.js
'use strict';

var LocalStorageO = require('node-localstorage').LocalStorage;
var path = require('path');
var os = require('os');
var temp = path.normalize(path.join(os.tmpdir(), '/.local_storage_'));
var DEFAULT_STORAGE_PATH = temp;

var LocalStorage = {
  setId: function setId(id) {
    if (id === undefined) {
      throw new Error('vorpal.localStorage() requires a unique key to be passed in.');
    }
    if (!this._localStorage) {
      this._localStorage = new LocalStorageO(DEFAULT_STORAGE_PATH + id);
    }
  },
  validate: function validate() {
    if (this._localStorage === undefined) {
      throw new Error('Vorpal.localStorage() was not initialized before writing data.');
    }
  },
  getItem: function getItem(key, value) {
    this.validate();
    return this._localStorage.getItem(key, value);
  },
  setItem: function setItem(key, value) {
    this.validate();
    return this._localStorage.setItem(key, value);
  },
  removeItem: function removeItem(key) {
    this.validate();
    return this._localStorage.removeItem(key);
  }
};

module.exports = LocalStorage;