Simple, beginer-friendly JSON based database.
This package is in the early access phase.
**Documentation: ** titon-design.gitbook.io/titondb
npm i titondb
const TitonDB = require('TitonDB')
// Initialise database
let db = new TitonDB('db.json')
// db.json
// { "money": {
// "euro": 50,
// "usd": 30,
// "pln: 15
// }}
// Set "money -> euro" to 50
db.set('money.euro', 50);
// Get "money -> euro" value
db.get('money.euro'); // 50
// Add 10 to "money -> euro"
db.add('money.euro', 10);
// Subtract 10 from "money -> euro"
db.subtract('money.euro', 10);
// Returns number of records inside "money"
db.length('money') // 3
// Get values larger than 20 from "money"
db.filter('money', 'largerThan', 20) // { usd: 40, euro: 50 }
// Get highest value from "money"
db.filter('money', 'max') // { euro: 50 }
// Sort money by largest to smallest values and return keys of these values
db.sort('money', 'largest', 'key') // {'euro', 'usd', 'pln'}
// Delete "money" from database
db.delete('money');
// Clear whole database
db.clear();
// Get database as JSON
db.json();