dynamic-forms / Function

resolveArrayPath

Resolves an array placeholder path to a concrete indexed path.

Presentation

function resolveArrayPath(path: string, index: number): string;

Returns

string -

Resolved path with index (e.g., "items.0.quantity")

Parameters

NameTypeDescription
path
string

The path with $ placeholder (e.g., "items.$.quantity")

index
number

The array index to substitute

Example usage

resolveArrayPath('items.$.quantity', 2)
// 'items.2.quantity'

resolveArrayPath('orders.lineItems.$.total', 0)
// 'orders.lineItems.0.total'