Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

memory-web-storage

Andarist6.7kMIT1.0.0TypeScript support: included

Simple replacement for web storages (i.e. localStorage) with the same API

memory, storage, localStorage, sessionStorage

readme

memory-web-storage

npm version npm

This is a library providing a singleton object with API similar to Web Storage:

  • getItem
  • setItem
  • removeItem
  • clear

default export

Mentioned singleton object.

createStorage(): MemoryStorage

Factory function creating memory storages.

testStorageSupport(type = 'local'): boolean

Meant to be used in browsers for testing storages support. It simply tries to perform most common operations on the storage object and wraps that with try/catch blocks.