objson v1.3.4
Welcome! Objson is a new Node.js module that serves as a simple database solution, utilizing both JSON and the 'fs' module.
DOCUMENTATION
Module initialization
const Objson = require('objson')
const objson = new Objson.objson()
Creating a DATABASE
objson.createDB('database-name')
Deleting a DATABASE
objson.deleteDB('database-name')
DELETING ALL VARIABLES in a DATABASE
objson.clearDB('database-name')
Renaming a DATABASE
objson.renameDB('old-database-name','new-database-name')
Copying data from an existing DATABASE to a NEW UNCREATED DATABASE
objson.copyDB('database-name-existing','new-database-name')
List the name of every existing database in an array
objson.listDBName().then(result=>{
/*handle result*/
})
setting a variable in the database follows (key,value) syntax
objson.setVar('database-name','variable-name',value)
deleting a variable from the database
objson.deleteVar('database-name','variable-name')
getting the value of a specific variable in the database
objson.getVar('database-name','variable-name')
getting the value of a specific variable in the database(method 2)
objson.getDB('database-name')['variable-name']
getting all variables in a database. Note, the function returns a single object containing every (variable, value) pairs.
objson.getDB('database-name')
getting all variables in a database in the form on an array of objects. {variable:value},...
objson.getDBArray('database-name')
RunKIT example
//Module initialization
var objson = require("objson")
var Objson = new objson.objson()
//Database creation
Objson.createDB('players')
//Defining a variable in the database
Objson.setVar('players','sam',{age:20})
//Getting the value of a variable
console.log(Objson.getVar('players','sam'))
If you would like to report any bugs within this module, Or would just like to ger additional guidance, feel free to contact me on one of the following platforms: Instagram: minedeath.gt Discord: minedeath_