xlinx.db

1.1.0 • Public • Published
const XlinxDB = require('xlinx.db');
const db = new XlinxDB()

// Setting an object in the database:
db.set('userInfo', { difficulty: 'Easy' })
// -> { difficulty: 'Easy' }

// Pushing an element to an array (that doesn't exist yet) in an object:
db.push('userInfo.items', 'Sword')
// -> { difficulty: 'Easy', items: ['Sword'] }

// Adding to a number (that doesn't exist yet) in an object:
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword'], balance: 500 }

// Repeating previous examples:
db.push('userInfo.items', 'Watch')
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 500 }
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 1000 }

// Fetching individual properties
db.get('userInfo.balance') // -> 1000
db.get('userInfo.items') // ['Sword', 'Watch']

// Unpushing array
db.unpush('userInfo.items','Sword') // ['Watch']

Readme

Keywords

Package Sidebar

Install

npm i xlinx.db

Weekly Downloads

11

Version

1.1.0

License

ISC

Unpacked Size

3.41 kB

Total Files

3

Last publish

Collaborators

  • aventadoria