How to use the node-localstorage.JSONStorage.prototype function in node-localstorage

To help you get started, we’ve selected a few node-localstorage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EtherWorld / EtherWorld / src / shared / storage.js View on Github external
if (global.window) {
  var ls = require('local-storage');
} else {
  var LocalStorage = require('node-localstorage').JSONStorage;

  // Normalise the method names so they're consistent.
  LocalStorage.prototype.set = LocalStorage.prototype.setItem;
  LocalStorage.prototype.get = LocalStorage.prototype.getItem;
  LocalStorage.prototype.remove = LocalStorage.prototype.removeItem;

  var path = require('path').normalize(__dirname + '../../../db');

  ls = new LocalStorage(path);
}


module.exports = ls;
github EtherWorld / EtherWorld / src / shared / storage.js View on Github external
if (global.window) {
  var ls = require('local-storage');
} else {
  var LocalStorage = require('node-localstorage').JSONStorage;

  // Normalise the method names so they're consistent.
  LocalStorage.prototype.set = LocalStorage.prototype.setItem;
  LocalStorage.prototype.get = LocalStorage.prototype.getItem;
  LocalStorage.prototype.remove = LocalStorage.prototype.removeItem;

  var path = require('path').normalize(__dirname + '../../../db');

  ls = new LocalStorage(path);
}


module.exports = ls;
github EtherWorld / EtherWorld / src / shared / storage.js View on Github external
if (global.window) {
  var ls = require('local-storage');
} else {
  var LocalStorage = require('node-localstorage').JSONStorage;

  // Normalise the method names so they're consistent.
  LocalStorage.prototype.set = LocalStorage.prototype.setItem;
  LocalStorage.prototype.get = LocalStorage.prototype.getItem;
  LocalStorage.prototype.remove = LocalStorage.prototype.removeItem;

  var path = require('path').normalize(__dirname + '../../../db');

  ls = new LocalStorage(path);
}


module.exports = ls;

node-localstorage

A drop-in substitute for the browser native localStorage API that runs on node.js.

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis