1.0.3 • Published 4 years ago
nathanjs.db v1.0.3
NathanJS.DB
NathanJS.DB is a light weight & easy to use package meant to provide an easy way for beginners, and people of all levels to access & manage a database.
- Data doesnt disappear through restart
- Easy Setup
- Discord Support
- and more!
Examples
In NathanJS.DB all data can be managed and configured
const db = require('nathanjs.db');
// -------- <db>.set --------- //
// Sets an object to a certain variable:
db.set('myUser', { books: ['Notebook'] })
// --> { books: ['Notebook'] }
// -------- <db>.push --------- //
// Pushes an object to an array (that does not exist) in a variable:
db.push('myUser.type', 'Medium')
// --> { books: ['Notebook'], type: 'Medium' }
// Repeating a previous example:
db.push('myUser.books', 'Big Book')
// --> { books: ['Notebook', 'Big Book'], type: 'Medium' }
// -------- <db>.add --------- //
// Adding a number object to an array (that does not exist) in a variable:
db.add('myUser.balance', 500)
// --> { books: ['Notebook', 'Big Book'], type: 'Medium', balance: 500 }
// Repeating previous examples:
db.add('myUser.balance', 500)
// --> { books: ['Notebook', 'Big Book'], type: 'Medium', balance: 1000 }
// -------- <db>.subtract --------- //
// Subtracting a number object to an array (that does exist) in a variable:
db.subtract('myUser.balance', 500)
// --> { books: ['Notebook', 'Big Book'], type: 'Medium', balance: 500 }
// Repeating previous examples:
db.subtract('myUser.balance', 500)
// --> { books: ['Notebook', 'Big Book'], type: 'Medium', balance: 0 }
// -------- <db>.get --------- //
db.get('myUser.balance') // -> 0
db.get('myUser.books') // ['Notebook', 'Big Book']
Installation
If you're having troubles installing, please follow this troubleshooting guide.
Linux & Windows
npm i nathanjs.db
*Note: Windows users may need to do additional steps listed here.*
Mac
1. Install: XCode
2. Run: npm i -g node-gyp
in terminal
3. Run: node-gyp --python /path/to/python2.7
(skip this step if you didn't install python 3.x)
4. Run: npm i quick.db
Credits
Creator: nathan_dev