0.1.0 • Published 3 years ago

@tinysorcerer/tinyjson v0.1.0

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

TinyJson

State database without dependencies.

How to

Setup

Import class

import TinyJson from './path/to';

Or

import TinyJson from '@tinysorcerer/tinyjson';

Use

The class makes push, pop, and update available to interact with the object.

const t = new TinyJson();

t.push({ value: true });
t.push({ value: false });
t.push({ value: 'lorem' });
/**
 * Initial Value:
 * [
 *   { value: true, _id: "dyt-ezpzg" },
 *   { value: false, _id: "gek-xyyxp" },
 *   { value: "lorem", _id: "eei-vfsmi" }
 * ]
 */

t.pop('gek-xyyxp');
/**
 * Remove 2nd Entry:
 * [
 *   { value: true, _id: "dyt-ezpzg" },
 *   { value: "lorem", _id: "eei-vfsmi" }
 * ]
 */

t.update('eei-vfsmi', { value: false });
/**
 * Update Last Entry:
 * [
 *   { value: true, _id: "dyt-ezpzg" },
 *   { value: false, _id: "eei-vfsmi" }
 * ]
 */

console.log(t.find('dyt-ezpzg'));
/**
 * Find 1st Entry:
 * [
 *   { value: true, _id: 'dyt-ezpzg' }
 * ]
 */

console.log(t.get);
/**
 * Final Value: [{"value":true,"_id":"dyt-ezpzg"},{"value":false,"_id":"eei-vfsmi"}]
 */

yarn test to see this in action.

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago