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