npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

super-firebase-hooks

v1.3.3

Published

Its simple firebase query , that inspired by sql like syntax, easy to remember and use

Downloads

16

Readme

# super-firebase-hook

`super-firebase-hook` is a simple wrapper around Firebase Firestore SDK version 9 that provides a chainable API for performing CRUD operations.

Installation

  1. Install Firebase SDK version 9 in your project:
npm install firebase super-firebase-hooks
  1. Create a new file named firebase.js and import the FirebaseQuery wrapper. Initialize it with your Firebase configuration and export it:
import { initializeApp } from "firebase/app";
import { getFirestore, collection, query, where, getDocs, addDoc, doc, updateDoc, deleteDoc } from "firebase/firestore";
import FirebaseQuery from 'super-firebase-hooks';


const firebaseConfig = {
  // your Firebase config here
};

const firebaseApp = initializeApp(firebaseConfig);

const DB = getFirestore(firebaseApp);

const firebase = new FirebaseQuery(DB);

export default firebase;

Usage

Import the firebase wrapper in your file and use it to perform CRUD operations:

Select documents

Select all documents from the users collection:

import firebase from "./firebase";

const { data, error } = await firebase.select("users").get();
console.log(data);

Select documents by ID

Select all documents from the users collection:

import firebase from "./firebase";

const { data, error } = await firebase.select("users").getById("userid");
console.log(data);

Query documents

Query documents from the users collection where the age field is greater than or equal to 18:

import firebase from "./firebase";

const { data, error } = await firebase
  .select("users")
  .where("age", ">=", 18)
  .get();
console.log(data);

Insert a document

Insert a new document into the users collection:

import firebase from "./firebase";

const { error } = await firebase.select("users").insert({ name: "Ahmad" });
console.log(error);

Insert a new document into the users collection with id:

import firebase from "./firebase";

const { error } = await firebase
  .select("users")
  .insert({ name: "Ahmad" }, "docId");
console.log(error);

Insert many document

Insert a new document into the users collection:

import firebase from "./firebase";

const { ids, error } = await firebase
  .select("users")
  .insertMany([{ name: "Ahmad" }, { name: "Ali" }]);
console.log(error);

Update a document

Update a document in the users collection by its document ID:

import firebase from "./firebase";

const { error } = await firebase
  .select("users")
  .update("docId", { name: "John" });
console.log(error);

Delete a document

Delete a document in the users collection by its document ID:

import firebase from "./firebase";

const { error } = await firebase.select("users").delete("docId");
console.log(error);

License

super-firebase-hooks is released under the MIT License.

Github Repo for open source contribute

https://github.com/m-ahmad001/super-firebase-hooks