storage-utilities

Utilities for working with local/sessionStorage.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
storage-utilities
0.0.25 years ago5 years agoMinified + gzip package size for storage-utilities in KB

Readme

storage-utilities

Usage

import { parse, stringify } from 'storage-utilities'

// Sample of what localStorage might be.
const localStorage = {
  foo: "muahaha",
  fee: "[0, 1, 2]"
}

const foo: string = parse(localStorage.getItem('foo'))
// "muahaha"

const fee: number[] = parse(localStorage.getItem('fee'))
// [0, 1, 2]

const bar: string = stringify({ name: 'Tommy' })
// "{ name: 'Tommy' }"

const baz: string = stringify("yolo")
// "yolo"