@bytesoftio/helpers-local-storage
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@bytesoftio/helpers-local-storage

Installation

yarn add @bytesoftio/helpers-local-storage or npm install @bytesoftio/helpers-local-storage

Table of contents

Description

This package provides several localStorage related helper functions.

readLocalStorage

Reads a value from localStorage.

import { readLocalStorage } from "@bytesoftio/helpers-local-storage"

type AuthData = { token: string | undefined }

const defaultData: AuthData = {token: undefined}
const data = readLocalStorage<AuthData>("auth", defaultData)

writeLocalStorage

Writes a value to localStorage.

import { writeLocalStorage } from "@bytesoftio/helpers-local-storage"

const data = { token: "foo" }
writeLocalStorage("auth", data)

Readme

Keywords

none

Package Sidebar

Install

npm i @bytesoftio/helpers-local-storage

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

3.05 kB

Total Files

10

Last publish

Collaborators

  • maximkott