@davidegheri/storage
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Storage

Build Status Coverage Status npm version GitHub version Greenkeeper badge

Small browser storage API library

Usage

    var storage = new Storage('localstorage');
    storage.set('key', 'hello world'); // true
    storage.get('key') // hello world

Available adapters:

  • localstorage : Use the window.localstorage
  • sessionstorage : Use the window.sessionstorage
  • cookie : Use the document.cookie string
Methods

set(key, value, options? (cookie only)): boolean

set the given value in the storage by the given key, options: for cookie storage you can pass storing options that overwrites the defaults

get(key, default?): any

get the value from the storage by the given key, optional default value is returned if nothing is found

delete(key): boolean

remove the value from the storage by the given key

clear(): void

remove all values from the storage

Readme

Keywords

none

Package Sidebar

Install

npm i @davidegheri/storage

Weekly Downloads

1

Version

3.0.1

License

MIT

Unpacked Size

441 kB

Total Files

59

Last publish

Collaborators

  • davide-gheri