@mybadprojects/jsondb
v1.0.4
Published
A json based database which is easy to use and compact. Update: Removed 'database' and 'value'.
Downloads
2
Readme
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 })