titondb

1.1.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i titondb

Weekly Downloads

0

Version

1.1.3

License

MIT

Unpacked Size

8.41 kB

Total Files

3

Last publish

Collaborators

  • titondesign