deno.land / x / domain_functions@v1.2.0 / src / utils.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { z } from 'https://deno.land/x/zod@v3.19.1/mod.ts'
import type { MergeObjs, Result, SchemaError, SuccessResult } from './types.ts'
const formatSchemaErrors = (errors: z.ZodIssue[]): SchemaError[] => errors.map((error) => { const { path, message } = error return { path: path.map(String), message } })
function isListOfSuccess<T>(result: Result<T>[]): result is SuccessResult<T>[] { return result.every(({ success }) => success === true)}
const mergeObjects = <T extends unknown[] = unknown[]>(objs: T) => Object.assign({}, ...objs) as MergeObjs<T>
export { formatSchemaErrors, mergeObjects, isListOfSuccess }
domain_functions

Version Info

Tagged at
a year ago