0.0.4 • Published 3 years ago

noice.db v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

A simple JSON database.

How to install:

npm install simple.db

Methods:

create

const db = require("noice.db")
// Creating the database file 
db.create()
// Done!

add

const db = require("noice.db")

// Addding a value to the current value
db.add('joins', 1)
// If the current value is 1, so the value will be 2.

set

const db = require("noice.db")
// Setting an value to a key
db.set(`name`, 'daniel')
// Now, the key 'name' will give the value 'daniel'

get

const db = require("noice.db")
// Get a value from a key
db.get(`name`)
// Will return 'daniel', because we made a setting with the key 'name' and the value 'daniel'

has

const db = require("noice.db")
// Checks if we have key in the database that named 'name'
db.has(`name`)
// If yes, This will return 'true', If no, it will return 'false'.

delete

const db = require("noice.db")
// Deletes a key from the database
db.delete(`name`)
// Done!

deleteAll

const db = require("noice.db")
// Deletes all the keys in the database
db.deleteAll()
// Done!

all

const db = require("noice.db")
// Get all the data(keys) in a array
db.all().join("\n")
/* So, if we saved the key 'name' with the value 'daniel', and we saved the key 'joins' with the value '1' we will get this: 
name
joins
*/

push

const db = require("noice.db")
// Pushing a value to array
db.push(`name`, 'hello') // Will return ['hello'] with 'get' method
// Done! you can use 'get' method to get the array!

reset

const db = require("noice.db")
// Resets a key (Number)
db.reset(`joins`)
// Done! you can use 'get' method to get '0'!