UNPKG

firelordjs

Version:

🔥 High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience

20 lines (19 loc) • 779 B
import { updateDoc as updateDoc_ } from 'firebase/firestore'; import { flatten } from '../utils'; /** * Updates fields in the document referred to by the specified * `DocumentReference`. The update will fail if applied to a document that does * not exist. * * @param reference - A reference to the document to update. * @param data - An object containing the fields and values with which to * update the document. Fields can contain dots to reference nested fields * within the document. * @returns A `Promise` resolved once the data has been successfully written * to the backend (note that it won't resolve while you're offline). */ export var updateDoc = function (reference, data) { return updateDoc_( // @ts-expect-error reference, flatten(data)); };