1.1.3 • Published 1 year ago

titondb v1.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

TitonDB

Simple, beginer-friendly JSON based database.

TitonDB logo

This package is in the early access phase.

Documentation: titon-design.gitbook.io/titondb

Installation

npm i titondb

Example

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();
1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago