zod arg parse 작업 진행
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import type { ZodType } from 'zod';
|
||||
|
||||
export const parseArgsWithSchema = <T>(schema: ZodType<T>, raw: unknown): T | null => {
|
||||
const result = schema.safeParse(raw);
|
||||
return result.success ? result.data : null;
|
||||
};
|
||||
Reference in New Issue
Block a user