npm.io
1.0.4 • Published 5 years ago

@mybadprojects/jsondb

Licence
ISC
Version
1.0.4
Deps
0
Size
3 kB
Vulns
0
Weekly
0

JsonDB

A simple JSON powered database package. This is a simplistic package made for people who do not want to learn actual databases!

Documentation

createDatabase

createDatabase: Creates a JsonDB string instance and calls back the database.

Usage
JsonDB.createDatabase('userInformation', 'contains user information', (database) => {
});
getValue

getValue: Gets a value from the database.

Usage
let value1 = JsonDB.getValue(database, 'valueName')
removeValue

removeValue: Removes the value determined.

Usage
JsonDB.removeValue(database, 'valueName', (newDatabase) => { database = newDatabase })
loadDatabase

loadDatabase: Loads a database in the current folder. To access another folder, put the file's location without the extension (.db.json).

Usage
JsonDB.loadDatabase('userInformation', (database) => {
});
saveDatabase

saveDatabase: Saves the database, requires no callbacks.

SAVES TO THE FILE DEPENDING ON DATABASE NAME
Usage
JsonDB.saveDatabase(database)
setValue

setValue: Sets the value of an object.

Usage
JsonDB.setValue(database, 'valueName', 'value', (newDatabase) => { database = newDatabase })