Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async _operate(snapshot, isFirst) {
let changes = [];
if (snapshot instanceof FirebaseFirestore.QuerySnapshot) {
changes = snapshot.docChanges;
}
else {
changes = snapshot.docChanges();
}
changes.forEach(async (change) => {
const id = change.doc.id;
switch (change.type) {
case 'added': {
const document = await this._get(change.doc.id, change.doc.data());
this.documents.push(document);
this.documents = this.documents.sort(this.option.sortBlock);
if (!isFirst) {
const IDs = this.documents.map(doc => doc.id);
if (IDs.includes(id)) {
const index = IDs.indexOf(id);