UNPKG

firesage

Version:

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

23 lines (20 loc) • 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayUnion = void 0; var firestore_1 = require("firebase/firestore"); /** Returns a special value that can be used with @firebase/firestore/lite#(setDoc:1) or * @firebase/firestore/lite#(updateDoc:1) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements. @param elements — The elements to union into the array. @returns The FieldValue sentinel for use in a call to setDoc() or updateDoc(). */ var arrayUnion = function () { var elements = []; for (var _i = 0; _i < arguments.length; _i++) { elements[_i] = arguments[_i]; } var ref = firestore_1.arrayUnion.apply(void 0, elements); ref['Firelord.ArrayFieldValue'] = elements; return ref; }; exports.arrayUnion = arrayUnion;