smaki

Use json files as a database

Usage no npm install needed!

<script type="module">
  import smaki from 'https://cdn.skypack.dev/smaki';
</script>

README

Smaki JSON

Interact with json object like a database

Installation

$ npm install smaki

Basic usage

var Smaki = require('smaki');

var json = {
    "a": 1,
    "b": 2
};

var smaki = new Smaki(json);

API

Compress

Compress and minify the json:

smaki.compress();
// => a|b^1|2^^$0|2|1|3]

Uncompress

Uncompress a minified json:

smaki.uncompress();

Get

Get value:

smaki.get(key);

Get Objects

Get objects:

smaki.getObjects([key], [value], [objects]);

Get Paths

Get paths:

smaki.getObjects([key], [val], [obj], [stringify], [path]);

Get Values

Get values:

smaki.getValues(key, [obj]);

Get Keys

Get keys:

smaki.getKeys(value, [obj]);

Delete

Delete objects:

smaki.deleteObject(key, [value], [obj]);

Update

Update objects:

smaki.updateObject(key, value, [oldValue], [obj]);

License

MIT


Marcos Sanz Latorre copyright 2116 marcos.sanz@13genius.com