1.0.4 • Published 5 years ago

@jhoot/simplestore v1.0.4

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

@jhoot/simplestore - Simple Store

SimpleStore is a CRUD enabled object reference.

Motivation

I was tired of loaded applications with a ton of the complexity that you need in order to understand and correctly implement other state libraries like Redux or Vuex.

I wanted to create a plug and play CRUD object reference for use in my projects and here it is.

Dependencies

None.

Installation

npm i @jhoot/simplestore

Setup

Create a folder in your /src/ dir called store and a index.js file inside that directory.

Place the following code in that file:

import SimpleStore from '@jhoot/simplestore'

const store = new SimpleStore();

export default store;

Wherever you'd like to access this store, import the store:

import store from '<src_dir>/store';

Methods

Set:

Sets a key:value pair within the store object. Takes two parameters.

SimpleStore.set(key, value);

Get:

Takes a key parameter, returns the value of said key.

SimpleStore.get(key);

Update:

Takes a key and value parameter, searches for key in store, if found updates it, if not launches a console.warn saying that it did not find the key inside the store.

SimpleStore.update(key, value);

Delete:

Takes a key parameter, looks through the store to see if it exists. If there is a key:value for provided key, deletes it.

SimpleStore.delete(key);

Links

View on github

View on npm

1.0.4

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