dynamic-forms / Function

resolveMultiArrayPath

Resolves a path with multiple array placeholders using provided indices.

Each $ placeholder is replaced with the corresponding index from the indices array, in order.

Presentation

function resolveMultiArrayPath(path: string, indices: number[]): string;

Returns

string -

Resolved path (e.g., 'orders.0.items.2.quantity')

Parameters

NameTypeDescription
path
string

Path with $ placeholders (e.g., 'orders.$.items.$.quantity')

indices
number[]

Array of indices to substitute (e.g., [0, 2])

Example usage

resolveMultiArrayPath('orders.$.items.$.quantity', [0, 2])
// 'orders.0.items.2.quantity'

resolveMultiArrayPath('items.$.name', [5])
// 'items.5.name'