0.1.0 • Published 2 years ago

@ajayguptadev/datastore v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

datastore-js

Status

Tests Issues PRs

Introduction

Datastore.js is built on top of plain JavaScript objects as they can store any type of data in key value pairs. They can have nested objects and arrays as a value. The logic is fairly simple: every datastore instance initializes a new object and all the CRUD operations are performed on it.

Installation

yarn add @ajayguptadev/datastore

Documentation

createDataStore

Create a new datastore.

const notesDataStore = createDataStore();

getStore

Return everything in the store.

const results = notesDataStore.getStore();

clearStore

Clear the store.

notesDataStore.clearStore();

getItem(key: string)

Get an item from the store.

const result = notesDataStore.getItem("key1");

setItem(key: string, value: any)

Set an item in the store.

notesDataStore.setItem("key1", "value1");

removeItem(key: string)

Remove an item from the store.

notesDataStore.removeItem("key1");