firestore-function-utils
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

Firestore Function Utils

npm version

Overview

This zero dependency package includes some utility functions and types for writing Google Cloud Function triggers for Firestore.

Example

export function onUserChange(change: FirestoreChange<T>, event: FirestoreEvent) {
    const before = parseFirestoreChangeValue('userId', change, event);
    const after = parseFirestoreChangeValue('userId', change, event);
    console.log(before);
    /*
    {
      id: "0vdxYqEisf5vwJLhyLjA"
      createdAt: Date('2019-04-29T16:35:33.195Z'),
  	  updatedAt: Date('2019-04-29T16:35:33.195Z'),
  	  data: {
  	  	username: 'johndoe',
  	  	gender: 'male',
  	  	newsletter: true
  	  }
    }
     */

}

Readme

Keywords

none

Package Sidebar

Install

npm i firestore-function-utils

Weekly Downloads

1

Version

2.0.8

License

MIT

Unpacked Size

16.2 kB

Total Files

15

Last publish

Collaborators

  • dominicbartl