Skip to content

Repository files navigation

A Web Storage Wrapper

NPM VersionNPM Downloadsjs-happiness-style

Web storage for cookies/localStorage/sessionStorage/memory with expiration and other helpful features.

Features:

  • Multiple storage drivers guarantee at minimum in memory storage
  • Filter value, useful for storing json or other non-string data
  • Filter key, useful for consolidating keys
  • Use cookie like path and expires with local and session storage

Install

$ npm install --save @streammedev/storage

Usage

varStorage=require('@streammedev/storage');varstore=newStorage({// backend: null, specify a backend with either a // string name or constructor functionbackend: 'memory'// Sets the domain, only used with cookiesdomain: 'example.com',// Filter function for getting and setttingsetValueFilter: identity,getValueFilter: identity,// Filter function for the keykeyFilter: identity});store.setItem('foo','bar');store.getItem('foo');// 'bar'store.removeItem('foo');store.getItem('foo');// undefinedstore.clear('foo');// undefined

Contributing

Contributions are welcome. Please see our guidelines in CONTRIBUTING.md.

About

A web storage wrapper

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages