jizy-data
A simple data management library for JavaScript applications.
Installation
npm install jizy-data
Usage
import jData from 'jizy-data';
const store = new jData();
store.set('key', 'value');
console.log(store.get('key'));
store.sets({ foo: 1, bar: 2 });
store.def('baz', 42);
console.log(store.has('foo'));
API
new jData()
Creates a new data store instance.
.set(key, value)
Sets a value for the given key.
.sets(object)
Sets multiple key-value pairs from an object.
.get(key, [default])
Gets the value for a key, or returns default
(or null
) if not set.
.def(key, value)
Sets a default value for a key if it is not already set.
.has(key)
Returns true
if the key exists in the store.