UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

6 lines (5 loc) 350 B
import { z } from 'zod'; import { withValidate } from '../utils.js'; import { schemaZodFormatter } from './schema.js'; import { withOptional } from './utils.js'; export const getSetZodFormatter = (schema, options = {}) => withOptional(schema, options, withValidate(schema, z.set(schemaZodFormatter(schema.elements, { ...options, defined: true }))));