Branches class
📖 Description
The Branches class represents a collection of branches in a form definition. Each branch in the collection is a Branch instance.
🗃️ Fields
🏷️ all
Retrieves all the branches that are in the collection.
Type
🏷️ count
Retrieves the number of branches in the collection.
Type
number
🏷️ firstItem
Retrieves the first branch in the collection.
Type
Branch | undefined
🏷️ lastItem
Retrieves the last branch in the collection.
Type
Branch | undefined
▶️ Methods
🔧 each
Iterates through all branches in the collection.
Signature
each(fn: (branch: Branch) => boolean | void): boolean
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
fn | (branch: Branch) => boolean | void | No | Function that is called for each branch in the collection. If you want to stop the iteration, you can return true from this function to do so. |
Return value
Returns true if the iteration was stopped (break).
🔧 reverseEach
Iterates through all branches in the collection in reverse direction (starting with the last branch).
Signature
reverseEach(fn: (branch: Branch) => boolean | void): boolean
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
fn | (branch: Branch) => boolean | void | No | Function that is called for each branch in the collection. If you want to stop the iteration, you can return true from this function to do so. |
Return value
Returns true if the iteration was stopped (break).