1.0.1 • Published 4 years ago
same.json v1.0.1
SAME.JSON
A simple json local database
What can this package do?
Nothink. Literally nothing. It just a copy of SAME.DB but a bit more lightweight
How Can I Use This Package?
First of all we must import the package!
const { Json } = require("simple.json");
const db = new Json();
Ok well now here are all the methods!
db.set(key, value)
db.get(key)
db.has(key)
db.all()
db.delete(key)
db.clear()
db.deleteAll()
db.push(key, element)
db.add(key, number)
db.fetchAll()
db.subtract(key, count)
db.sub(key, count)
Ok now here are some examples!
// Set a value in the database;
db.set('money', 500); // money -> 500
// Increase the value in an object
db.add('money', 250) // money -> 750
// Decrease the value in an object
db.add('money', 500) // money -> 250
// Check if database has a value
var money = db.has('money'); // boolean
console.log(money) // true
// Set an object in the database
db.set('bank', { name: 'Maze Bank' }) // -> { name: 'Maze bank' }