1.1.7 • Published 9 months ago

@alwatr/local-storage v1.1.7

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
9 months ago

localJsonStorage

localJsonStorage is a utility object in our TypeScript package that provides methods for interacting with the local storage in a structured and versioned manner.

Installation

Before you can use localJsonStorage, you need to install the package. If you're using npm, you can do this with:

npm install @alwatr/local-storage

If you're using Yarn, you can do this with:

yarn add @alwatr/local-storage

Usage

First, you need to import localJsonStorage from the package:

import {localJsonStorage} from '@alwatr/local-storage';

Or for CommonJS:

const {localJsonStorage} = require('@alwatr/local-storage');

Getting an Item

You can get an item from local storage and parse it as JSON using the getItem method. If the item is not found, it will return a default value:

const defaultValue = {a: 1, b: 2};
const value = localJsonStorage.getItem('item-name', defaultValue);

Setting an Item

You can set an item in local storage as JSON using the setItem method:

const value = {a: 1, b: 2};
localJsonStorage.setItem('item-name', value);

Removing an Item

You can remove an item from local storage using the removeItem method:

localJsonStorage.removeItem('item-name');

Future Plans

We plan to add more methods to localJsonStorage for directly interacting with local storage. Stay tuned for updates!

1.1.7

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.1.6

9 months ago

1.1.5

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.10

10 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago