You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the Database class, you can pass in a parameter to set a file rather than using the default file!
If the file dosen't exist, it will create it
Path automatically set to ./
🔋 Examples
some exmaples
const{ Database }=require('mazeworldwide.db');constdb=newDatabase(/* db.json */)// Set / Push Functions Examplesvarobject1={key: true,key2: "true"}db.set('Object',object1);/* Object: {key: "value1", key2: "value2"} */vararray1=['element','element2']db.set('Array',array1);/* Array: ['element', 'element2'] */db.push('Array','element3');/* Array: ['element', 'element2', 'element3'] */// Object & Array Fetchdb.objectFetch('Object','key');/* key: "value1" */db.arrayFetch('Array',1);/* element2 */// Fetch / Get Functionsdb.fetch('data');// Fetches the value of the datadb.get('data');// Get the value of the datadb.fetchAll();// Fetches all the data in the databasedb.all();// Fetches everything in the database// Remove / Delete Functionsdb.remove('data');// Removes the data from the databasedb.delete('Array','element3');// Removing something from an array using value/indexdb.deleteKey('object','key');// Deletes the provided key from the given objectdb.deleteEach('data');// Deletes each data that starts with the given parameter// Clear / Destroy Functionsdb.clear();// Clears everything from the databasedb.destroy();// Delete the database file (And Clear All Data)// Boolean Functionsdb.has('data');// Returns "true" or "false" if the database has the data or not.// Maths Functionsdb.add('data',1);// Adds one to the datadb.subtract('data',1);// Subtracts one from the datadb.math("eco","+",10);// Adds 10 to the data (without set it), You Can Use [+,-,*,/]