firelordjs
Version:
🔥 High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
21 lines (20 loc) • 804 B
JavaScript
export var buildPathFromColIDsAndDocIDs = function (_a) {
var collectionIDs = _a.collectionIDs, documentIDs = _a.documentIDs;
return collectionIDs
.reduce(function (acc, collectionId, index) {
var documentID = documentIDs[index] ? "".concat(documentIDs[index], "/") : '';
return "".concat(acc).concat(collectionId, "/").concat(documentID);
}, '')
.slice(0, -1);
};
export var queryBuilder = function (queryConstraints) {
return queryConstraints.reduce(function (acc, qc) {
var type = qc.type;
(['startAt', 'startAfter', 'endAt', 'endBefore'].includes(type)
? // @ts-expect-error
qc.values.length > 0
: // @ts-expect-error
true) && acc.push(qc.ref);
return acc;
}, []);
};