Socket
Socket
Sign inDemoInstall

database-js-firebase

Package Overview
Dependencies
175
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 1.1.4

.travis.yml

7

package.json
{
"name": "database-js-firebase",
"version": "1.1.3",
"version": "1.1.4",
"description": "Database-js interface for Firebase",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test.js"
},

@@ -26,3 +26,6 @@ "repository": {

"node-sqlparser": "^1.0.2"
},
"devDependencies": {
"database-js": "^3.0.2"
}
}
# database-js-firebase
[![Build Status](https://travis-ci.org/mlaanderson/database-js-sqlite.svg?branch=master)](https://travis-ci.org/mlaanderson/database-js-sqlite)
Database-js interface for Firebase
## About

@@ -15,5 +18,12 @@ Database-js-firebase is a [database-js](https://github.com/mlaanderson/database-js) wrapper around the Firebase database library. It creates a Promises wrapper around an SQL to Firebase (NoSQL) interpreter.

[RunKit Demo](https://runkit.com/mlaanderson/runkit-npm-database-js2)
## Install
```shell
npm install database-js-firebase
```
## Usage
If your Firebase data is structured as:
~~~~
```json
"$uid": {

@@ -34,6 +44,6 @@ "users": {

}
~~~~
```
Then your access will be like:
~~~~
```javascript
var Database = require('database-js2');

@@ -55,2 +65,6 @@

})();
~~~~
```
## License
[MIT](https://github.com/mlaanderson/database-js/blob/master/LICENSE) (c) [mlaanderson](https://github.com/mlaanderson)
var db = require('.');
(async function () {
let connection = db.open({
Parameters: "apiKey=AIzaSyD1ypTmnJb_d8ZOyfc-KBMe0tw8owYCwjA",
Hostname: 'statesdemo',
Database: 'ewJviY6wboTKJ57A2dZkvq8kxYo1',
Username: 'user@example.com',
Password: 'password'
});
let stmt, results;
try {
results = await connection.query('SELECT * FROM states ORDER BY Ranking DESC');
console.log(results);
} catch (err) {
console.error(err);
} finally {
await connection.close();
setTimeout(() => { process.exit(); }, 0)
var connection = db.open({
Parameters: "apiKey=AIzaSyD1ypTmnJb_d8ZOyfc-KBMe0tw8owYCwjA",
Hostname: 'statesdemo',
Database: 'ewJviY6wboTKJ57A2dZkvq8kxYo1',
Username: 'user@example.com',
Password: 'password'
});
function handleError(error) {
console.log("ERROR:", error);
process.exit(1);
}
connection.query("SELECT * FROM states WHERE State = 'South Dakota'").then((data) => {
if (data.length != 1) {
handleError(new Error("Invalid data returned"));
}
})();
connection.close().then(() => {
process.exit(0);
}).catch(handleError);
}).catch(handleError);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc