1.2.2 • Published 2 years ago

my-cat-likes-firebase v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago