Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var p = [];
var filteredObject = o;
if (o instanceof ImageSeed) {
var bucket = admin.storage().bucket();
p.push(o.upload(bucket, parentDocID).then(url => {
filteredObject = url;
}));
} else if (o instanceof DocumentRefSeed) {
filteredObject = firestore.collection(o.collection).doc(o.document);
} else if (o instanceof SubcollectionSeed) {
const subcollectionRef = self.getCollection(firestore).doc(context.doc.id).collection(key!);
const subcollection = new CollectionSeed(o.docs, () => subcollectionRef);
filteredObject = DELETE;
context.postDocActions.push(() => subcollection.importDocuments(admin));
} else if (o instanceof GeoPointSeed) {
filteredObject = new GeoPoint(o.latitude, o.longitude);
} else if (o instanceof Date) {
filteredObject = Timestamp.fromDate(o);
} else if (o instanceof Timestamp) {
filteredObject = o;
} else if (o instanceof Array || o instanceof Object) {
filteredObject = o instanceof Array ? Array(o.length) : {};
for (let i in o) {
p.push(filterObject(context, i, o[i]).then(filteredChild => {
if (filteredChild !== DELETE) {
filteredObject[i] = filteredChild;
}
}));
}
}
return Promise.all(p).then(() => {
return new Promise((resolve, reject) => {