1.1.8 • Published 5 years ago

mj-local-storage-manager v1.1.8

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

local-storage-manager

Local Sotrage Manager

A useful library when dealing with local storage. Helps to safely and neatly load object or number types.

  • Typescript support
  • Avoid local key value mistakes
  • 0 dependencies

Usage

import LocalManager form "local-storage-manager";

type TlocalStorageKeys = "searchHookOpIndex" | "sortHookOpIndex" | "stateHookOpIndex"

const myLocalManager = LocalManager<TlocalStorageKeys>()

const {getLocal, getLocalNum, getLocalObj, saveLocal} = new LocalManager<TlocalStorageKeys>()

export {getLocal,getLocalNum,getLocalObj,saveLocal}

Method

  • saveLocal: save value auto stringFy
  • getLocalNum : try to return numberType
  • getLocal: try to return string.
  • getLocalObj: try to return string Object
nametypedesc
storage: 'localStorage', 'sessionStorage';what kind storage will be used
1.1.8

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago