Skip to content

unchainedui/storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unchained UI

Storage

NPM Version NPM Downloads

Local and session storage with JSON support

Usage

import { localStorage, sessionStorage, JSONStorage } from 'uc-storage'

sessionStorage.setItem('name', 'value')
const storage = JSONStorage(localStorage)

storage.set('data', [ 1, 2, 3 ])
const data = storage.get('data')
console.log(Array.isArray(data));
// true

Storage

This module exports the safe localStorage, sessionStorage with API identical to browser's.

JSONStorage(storage)

Wraps the storage object to save and parse JSON data inside the storage

set(key, value)

Sets the value

get(key)

Returns the value

remove(key)

Removes the key from the storage

License MIT

© velocityzen

About

Local and session storage with JSON support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published