šŸš€ Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

my-cat-likes-firebase

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

my-cat-likes-firebase

A firebase wrapper to make working with firebase painless

latest
Source
npmnpm
Version
1.2.2
Version published
Maintainers
1
Created
Source

my-cat-likes-firebase šŸ”„ 😺

A firebase wrapper to make working with firebase painless

npm install my-cat-likes-firebase

Quickstart & Initialization šŸ’Ø

Client side:

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

Server side

const { MyCatLikesFirebaseServer } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseCredentialsPath: "path/to/credentials",
  loggingEnabled: true,
});

A quick note about MyCatLikesFirebaseServer, all functions are the same as client side but do not support path segments.

Documentation šŸ“œ

Find Or Create Doc

Currently only works on Server

const { MyCatLikesFirebaseServer } = require("my-cat-likes-firebase");

const firebase = new MyCatLikesFirebaseServer({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.findOrCreateDoc({ someCoolData: ":)" }, `path/to/doc`)
ParameterTypeDescription
dataobjectThe data to write to the doc with if not found
pathstringThe path to the doc to write to or find

Returns a promise that resolves to a boolean returning the data that was either written or found in the doc

Create Doc

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.createDoc({ someCoolData: ":)" }, "path/to/doc");
ParameterTypeDescription
dataobjectThe data to write to the doc with
pathstringThe path to the doc to write to
pathSegments...stringAny additional path segments that will be added onto the path

Returns a promise that resolves to a boolean representing whether the write failed or not

Create or Update Doc

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.createOrUpdateDoc({ someCoolData: ":)" }, "path/to/doc");
ParameterTypeDescription
dataobjectThe data to write to the doc with
pathstringThe path to the doc to write to

Returns a promise that resolves to a boolean representing whether the write failed or not

Update Doc

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.updateDoc({ someCoolData: ":)" }, "path/to/doc");
ParameterTypeDescription
dataobjectThe data to write to the doc with
pathstringThe path to the doc to write to
pathSegments...stringAny additional path segments that will be added onto the path

Returns a promise that resolves to a boolean representing whether the write failed or not

Get Doc

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.getDoc("path/to/doc");
ParameterTypeDescription
pathstringThe path to the doc to get
pathSegments...stringAny additional path segments that will be added onto the path

Returns a promise that resolves to the doc data or an error string

Get Docs

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.getDocs("path/to/collection");
ParameterTypeDescription
pathstringThe path to the collection to fetch docs from

Returns a promise that resolves to an object containing the docs or an error

Delete Doc

const { MyCatLikesFirebase } = require("my-cat-likes-firebase");

let firebase = new MyCatLikesFirebase({
  firebaseConfig: config,
  loggingEnabled: true,
});

firebase.deleteDoc("path/to/doc");
ParameterTypeDescription
pathstringThe path to the doc to delete

Returns a promise that resolves to a boolean or an error string

Keywords

firebase

FAQs

Package last updated on 11 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts