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

17 lines (15 loc) 383 B
import {isNumberSchemaType, type SchemaType} from '@sanity/types' export function resolveNativeNumberInputValue( schemaType: SchemaType, value: unknown, localValue: string | undefined, ): string { if ( isNumberSchemaType(schemaType) && typeof localValue === 'string' && Number(localValue) === value ) { return localValue } return String(value ?? '') }