colshacol / storage-utilities

Utilities for working with local/sessionStorage.

Home Page:https://www.npmjs.com/package/storage-utilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"

About

Utilities for working with local/sessionStorage.

https://www.npmjs.com/package/storage-utilities


Languages

Language:JavaScript 100.0%