Kaizen
Browse modulesFormsforms/sharedFunctions

Function: normalizeOptionsForSave()

function normalizeOptionsForSave(options: (
  | string
  | {
  description?: string;
  value: string;
})[]): (
  | string
  | {
  description?: string;
  value: string;
})[];

Defined in: shared/forms/field-definitions.ts:114

Normalises a saved options array: object options with an empty or whitespace-only description collapse to a plain string value so the persisted schema doesn't carry no-op description: "" keys (which can appear when a builder UI's "Option description" toggle is enabled but never typed into). Also trims any non-empty descriptions in place.

Parameters

ParameterType
options( | string | { description?: string; value: string; })[]

Returns

( | string | { description?: string; value: string; })[]

On this page