Skip to content

validateFlag

function validateFlag(input, basePath?): ValidationResult;

Defined in: validation.ts:268

Validate a single flag: structure + semantic cross-field checks.

Parameter Type Default value
input unknown undefined
basePath? string "flag"

ValidationResult

import { validateFlag } from "@xtandard/flags";
const result = validateFlag({
key: "dark-mode",
type: "boolean",
enabled: true,
defaultVariant: "off",
variants: { on: { value: true }, off: { value: false } },
fallthrough: { variant: "off" },
});
// result.valid === true, result.errors === []