feat: biome check
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Collection, type CollectionOptions, type Db, type Document, type MongoClient } from "mongodb";
|
||||
import type { Collection, CollectionOptions, Db, Document, MongoClient } from "mongodb";
|
||||
|
||||
import { mongo } from "./client.ts";
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
"mongodb": "6.20.0",
|
||||
"zod": "4.1.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Db } from "mongodb";
|
||||
import z, { type ZodObject, type ZodType } from "zod";
|
||||
import type { ZodObject, ZodType, z } from "zod";
|
||||
|
||||
/**
|
||||
* TODO ...
|
||||
@@ -29,7 +29,7 @@ export function makeDocumentParser<TSchema extends ZodObject>(schema: TSchema):
|
||||
export function toParsedDocuments<TSchema extends ZodType>(
|
||||
schema: TSchema,
|
||||
): (documents: unknown[]) => Promise<z.infer<TSchema>[]> {
|
||||
return async function (documents: unknown[]) {
|
||||
return async (documents: unknown[]) => {
|
||||
const parsed = [];
|
||||
for (const document of documents) {
|
||||
parsed.push(await schema.parseAsync(document));
|
||||
@@ -44,7 +44,7 @@ export function toParsedDocuments<TSchema extends ZodType>(
|
||||
export function toParsedDocument<TSchema extends ZodType>(
|
||||
schema: TSchema,
|
||||
): (document?: unknown) => Promise<z.infer<TSchema> | undefined> {
|
||||
return async function (document: unknown) {
|
||||
return async (document: unknown) => {
|
||||
if (document === undefined || document === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user