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](/doc/en/lb4/apidocs.context.binding.html)<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>>[]