GitHub

validateFieldPresence

const

import { validateFieldPresence } from '@daffodil/core'

Validates whether all the specified fields are defined in the passed object. Uses Object.hasOwn to do the check, so even if a field has been set to null or undefined, they will be treated as present.

const validateFieldPresence: <T extends Record<string, unknown>>(model: T, ...fields: (keyof T)[]) => boolean