Class: Section
Defined in: packages/config-bound/src/section/section.ts:15
A grouping of Elements
Constructors
Constructor
new Section(
name,
elements,
description?,
logger?,
valueProvider?): Section;Defined in: packages/config-bound/src/section/section.ts:37
Parameters
| Parameter | Type |
|---|---|
name | string |
elements | Element<unknown>[] |
description? | string |
logger? | Logger |
valueProvider? | ConfigValueProvider |
Returns
Section
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
description? | string | An optional description of the Section | packages/config-bound/src/section/section.ts:23 |
name | string | The name of the Section | packages/config-bound/src/section/section.ts:19 |
Methods
addElement()
addElement(element): void;Defined in: packages/config-bound/src/section/section.ts:128
Adds a Element to the Section
Parameters
| Parameter | Type | Description |
|---|---|---|
element | Element<unknown> | The Element to add |
Returns
void
getConfigValueProvider()
getConfigValueProvider():
| ConfigValueProvider
| undefined;Defined in: packages/config-bound/src/section/section.ts:120
Gets the current value provider
Returns
| ConfigValueProvider | undefined
The current ConfigValueProvider or undefined if not set
getElement()
getElement(elementName):
| Element<unknown>
| undefined;Defined in: packages/config-bound/src/section/section.ts:163
Gets a specific element by name
Parameters
| Parameter | Type | Description |
|---|---|---|
elementName | string | The name of the element to get |
Returns
| Element<unknown> | undefined
The element or undefined if not found
getElements()
getElements(): Element<unknown>[];Defined in: packages/config-bound/src/section/section.ts:154
Gets the Elements of the Section
Returns
Element<unknown>[]
The array of Elements
getValue()
getValue<T>(elementName): Promise<T | undefined>;Defined in: packages/config-bound/src/section/section.ts:172
Gets the value of a specific element using the current value provider
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
elementName | string | The name of the element to get the value for |
Returns
Promise<T | undefined>
The value or undefined if not found or no value provider set
setConfigValueProvider()
setConfigValueProvider(valueProvider): void;Defined in: packages/config-bound/src/section/section.ts:111
Sets the value provider
Parameters
| Parameter | Type | Description |
|---|---|---|
valueProvider | ConfigValueProvider | The ConfigValueProvider to use |
Returns
void
setElements()
setElements(elements): void;Defined in: packages/config-bound/src/section/section.ts:84
Sets the Elements of the Section
Parameters
| Parameter | Type | Description |
|---|---|---|
elements | Element<unknown>[] | The array of Elements to set |
Returns
void
setLogger()
setLogger(logger): void;Defined in: packages/config-bound/src/section/section.ts:99
Sets the logger instance
Parameters
| Parameter | Type | Description |
|---|---|---|
logger | Logger | The logger to use |
Returns
void
findDuplicateElements()
static findDuplicateElements(elements): Element<unknown>[];Defined in: packages/config-bound/src/section/section.ts:59
Finds duplicate Elements in a given array.
Parameters
| Parameter | Type | Description |
|---|---|---|
elements | Element<unknown>[] | The array of Elements to search |
Returns
Element<unknown>[]
An array of Elements that have duplicate names