Skip to content

Instantly share code, notes, and snippets.

@tomorroN
tomorroN / firestore-field-filter.ts
Last active February 3, 2020 15:28 — forked from christianlacerda/firestore-field-filter.ts
Filters Firestore events based on field name and event type
import * as admin from 'firebase-admin';
import { Change, EventContext } from 'firebase-functions';
import { isEqual } from 'lodash';
import DocumentSnapshot = admin.firestore.DocumentSnapshot;
import FieldPath = admin.firestore.FieldPath;
const isEquivalent = (before: any, after: any) => {
return before && typeof before.isEqual === 'function'
? before.isEqual(after)