2.2.0 • Published 4 years ago
shorten-firebase v2.2.0
Install Shorten Firebase
$ npm install shorten-firebase
Features
- Simple & easy to use 🤘
- Beginner friendly 😱
- Lightweight 🛬
Getting Started
// Examples
const Shorten = require('shorten-firebase');
const firebase = require('firebase');
var firebaseConfig = {
apiKey: "xxxxxxxxxxxxxxxxxx",
authDomain: "xxxxxxxxx.firebaseapp.com",
projectId: "xxxxxxxxxxxxxxx",
storageBucket: "xxxxxxxxx.appspot.com",
messagingSenderId: "xxxxxxxxx",
appId: "x:xxxxxxxxx:web:xxxxxxxxxxxxxxxxxx"
};
firebase.initializeApp(firebaseConfig);
const database = new Shorten(firebase);
New changes
+ method "leaderboard"
+ updated error messages
Methods
// set
database.set('user', { username: 'Michael' }); // ref, data
// add
database.add('balance', 'money', 20); // ref, property, value
// subtraction
database.add('balance', 'money', -10); // ref, property, value (negative)
// remove
database.remove('balance'); // ref
// get
await database.get('balance', 'money'); // ref, property
// leaderboard
await database.leaderboard('balance/users', 'money') // ref, properties (max 5)