UNPKG

openai

Version:

The official TypeScript library for the OpenAI API

17 lines (14 loc) • 610 B
import type { ZodSchema, ZodTypeDef } from 'zod/v3'; export const zodDef = (zodSchema: ZodSchema | ZodTypeDef): ZodTypeDef => '_def' in zodSchema ? zodSchema._def : zodSchema; // oxlint-disable-next-line anti-slop/no-object-parameters -- Preserve the upstream utility contract: any object can have enumerable own or inherited keys. export function isEmptyObj(obj: object | null | undefined): boolean { if (!obj) { return true; } // oxlint-disable-next-line guard-for-in -- inherited enumerable properties make the object non-empty for (const _k in obj) { return false; } return true; }