Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((results) => {
const entities = results[0];
const info = results[1];
let nextPage = null;
if (info.moreResults !== Datastore.NO_MORE_RESULTS) {
nextPage = info.endCursor;
}
return {
nodes: entities.map(toNodeWithId),
pageCursor: nextPage
};
});
}
return datastore.runQuery(query).then(results => {
const entities = results[0];
const info = results[1];
let nextPage = null;
if (info.moreResults !== Datastore.NO_MORE_RESULTS) {
nextPage = info.endCursor;
}
return {
comments: addId(entities),
pageCursor: nextPage,
};
});
}
ds.runQuery(query, (err, entities, nextQuery) => {
if (err) {
reject(err);
}
const hasMore = nextQuery.moreResults !== Datastore.NO_MORE_RESULTS ? nextQuery.endCursor : false;
if (hasMore) {
runDSQuery(ds, nextQuery).then(moreEntities => {
resolve(entities.concat(moreEntities));
});
}
else {
resolve(entities);
}
});
});