0.2.1 • Published 8 months ago

pet-shop v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 months ago

pet-shop

A simple wrapper of Web Storage API.

npm license node

Installation

npm install pet-shop

Usage

import { PetShop } from 'pet-shop';

// plain-text store
const store = PetShop({
  namespace: 'pet-shop',
  storage: sessionStorage
});

store.set('abc', 'xyz');
store.get('abc'); // output: 'xyz'
store.size; // output: 1
localStorage.getItem('pet-shop.abc'); // output: 'xyz'

store.remove('abc');

store.has('abc'); // output: false
import { PetShop } from 'pet-shop';

// json store
const store = PetShop({
  namespace: 'pet-shop',
  storage: localStorage,
  json: true
});

store.set('abc', ['xyz']);
store.get('abc'); // output: ['xyz']
store.size; // output: 1
localStorage.getItem('pet-shop.abc'); // output: ['xyz']

store.remove('abc');

store.has('abc'); // output: false
0.2.1

8 months ago

0.2.0

9 months ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago