Page Contents

Home > @loopback/context > sortBindingsByPhase

sortBindingsByPhase() function

Sort bindings by phase names denoted by a tag and the predefined order

Signature:

export declare function sortBindingsByPhase<T = unknown>(bindings: Readonly<Binding<T>>[], phaseTagName?: string, orderOfPhases?: (string | symbol)[]): Readonly<Binding<T>>[];

Parameters

Parameter Type Description
bindings Readonly<Binding<T>>[] An array of bindings
phaseTagName string (Optional) Tag name for phase, for example, we can use the value 'a' of tag order as the phase name for binding.tag({order: 'a'}).
orderOfPhases (string | symbol)[] (Optional) An array of phase names as the predefined order

Returns:

Readonly<Binding<T>>[]