dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
6 lines (5 loc) • 376 B
JavaScript
import { z } from 'zod';
import { withValidate } from '../utils.js';
import { schemaZodFormatter } from './schema.js';
import { withOptional } from './utils.js';
export const tupleZodFormatter = (schema, options = {}) => withOptional(schema, options, withValidate(schema, z.tuple(schema.elements.map(element => schemaZodFormatter(element, { ...options, defined: false })))));