jizy-data
Version:
A simple JS data storage library.
53 lines (34 loc) • 971 B
Markdown
A simple data management library for JavaScript applications.
```bash
npm install jizy-data
```
```js
import jData from 'jizy-data';
const store = new jData();
// Set a value
store.set('key', 'value');
// Get a value
console.log(store.get('key')); // 'value'
// Set multiple values
store.sets({ foo: 1, bar: 2 });
// Set a default value (only if not already set)
store.def('baz', 42);
// Check if a key exists
console.log(store.has('foo')); // true
```
Creates a new data store instance.
Sets a value for the given key.
Sets multiple key-value pairs from an object.
Gets the value for a key, or returns `default` (or `null`) if not set.
Sets a default value for a key if it is not already set.
Returns `true` if the key exists in the store.