transformListItem

List
stable

Convert one raw item (string or object) to a normalised IInternalListItem with resolved title, value, optional children array, itemProps, and the original raw reference.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

props
required
Omit<IItemProps, 'items'> & { itemType?: string }
List props that control field extraction: `itemTitle`, `itemValue`, `itemChildren`, and `itemProps`.
item
required
any
The raw item — a string or a plain object. Strings are used directly as the title; objects are walked by the `itemTitle`/`itemValue` path props.

API

Return value

The value returned by this util.

A normalised object with `title` (string), `value`, `props`, `children` (recursively transformed array or undefined), and `raw` (original item).

Usage

Examples

Ready-to-paste usage snippets.

Normalise a plain object item

typescript