UNPKG

firelordjs

Version:

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

40 lines (39 loc) • 1.4 kB
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; import { doc } from 'firebase/firestore'; import { buildPathFromColIDsAndDocIDs } from './utils'; export var docCreator = function (fStore) { var collectionIDs = []; for (var _i = 1; _i < arguments.length; _i++) { collectionIDs[_i - 1] = arguments[_i]; } // @ts-expect-error return function (collectionReferenceOrDocumentId) { var documentIDs = []; for (var _i = 1; _i < arguments.length; _i++) { documentIDs[_i - 1] = arguments[_i]; } if (typeof collectionReferenceOrDocumentId === 'string') { return doc( // @ts-expect-error fStore, buildPathFromColIDsAndDocIDs({ collectionIDs: collectionIDs, documentIDs: __spreadArray([ collectionReferenceOrDocumentId ], documentIDs, true), })); } else { return doc( // @ts-expect-error collectionReferenceOrDocumentId); } }; };