UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

16 lines (11 loc) 396 B
import {type Validators} from '@sanity/types' import {genericValidators} from './genericValidator' export const booleanValidators: Validators = { ...genericValidators, presence: (flag, value, message, {i18n}) => { if (flag === 'required' && typeof value !== 'boolean') { return message || i18n.t('validation:generic.required', {context: 'boolean'}) } return true }, }