UNPKG

@canard/schema-form

Version:

React-based component library that renders forms based on JSON Schema with plugin system support for validators and UI components

18 lines (17 loc) 997 B
import type { Dictionary } from '../../../@aileron/declare'; import type { AllowedValue } from '../../../types'; export type ConditionDictionary = Dictionary<AllowedValue | AllowedValue[]>; /** * Converts a condition dictionary into an executable JavaScript expression string. * * Each condition is transformed into a JSONPointer-based comparison expression: * - Array values are converted to `includes` checks * - Other values are converted to equality comparisons * - Multiple conditions are combined with logical operators (&& or ||) * * @param condition - Dictionary of key-value pairs representing conditions * @param inverse - If true, converts to inverse (negated) conditions (default: false) * @param source - Base path for JSONPointer references (default: $.Parent) * @returns Combined condition expression string, or null if no conditions exist */ export declare const convertExpression: (condition: ConditionDictionary, inverse?: boolean, source?: string) => string | null;