unstable typescript

This commit is contained in:
tmshv committed 2019-10-14 23:42:43 +03:00
1 parent 274e1e7fc0
commit b35e4e36e2
19 files changed
+658 -286

No files matched your search

+3 -7
View File
@@ -1,4 +1,4 @@
async function find(collection, query, {sort, skip, limit}) {
export async function find(collection, query, {sort, skip, limit}) {
const cursor = collection.find(query)
if (sort) cursor.sort(sort)
@@ -8,16 +8,12 @@ async function find(collection, query, {sort, skip, limit}) {
return cursor.toArray()
}
async function findOne(collection, query) {
export async function findOne(collection, query) {
return collection.findOne(query)
}
async function total(collection, query) {
export async function total(collection, query) {
return collection
.find(query)
.count()
}
exports.find = find
exports.findOne = findOne
exports.total = total