good-storage
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/good-storage package

1.1.1 • Public • Published

storage

a storage lib which support sessionStorage and localStorage with the same api

Install

 npm install good-storage

Usage

 import storage from 'good-storage'
 
 // localStorage
 storage.set(key,val) 
 
 storage.get(key, def)
 
 // sessionStorage
 storage.session.set(key, val)
 
 storage.session.get(key, val)
 

API

set(key, val)

set storage with key and val

get(key, def)

get storage with key, return def if not find

remove(key)

remove storage with key

has(key)

determine storage has the key

clear()

clear all storages

getAll()

get all the storages

forEach(callback)

forEach the storages and call the callback function with each storage

/good-storage/

    Package Sidebar

    Install

    npm i good-storage

    Weekly Downloads

    2,491

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    17.3 kB

    Total Files

    16

    Last publish

    Collaborators

    • ustbhuangyi