Skip to main content

Class: RouterBranch

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:5

Extended by​

Constructors​

Constructor​

new RouterBranch(name: string, dynamic: boolean, parent: null | RouterBranch): RouterBranch

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:34

Parameters​

ParameterType
namestring
dynamicboolean
parentnull | RouterBranch

Returns​

RouterBranch

Properties​

_dynamicChild​

private _dynamicChild: null | RouterBranch = null

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:32


_staticChildren​

private _staticChildren: RouterBranch[] = []

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:31


dynamic​

readonly dynamic: boolean

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:14

Whether or not the branch is dynamic.


name​

readonly name: string

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:9

The name of the branch.


node​

readonly node: RouterNode

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:24

The node this branch is associated with.


parent​

readonly parent: null | RouterBranch

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:19

The parent branch, if any.


supportedMethods​

supportedMethods: readonly string[] = []

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:29

The methods supported by the branch's node or any of its children.

Accessors​

children​

Get Signature​

get children(): RouterBranch[]

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:52

The branches the branch is associated with

Version​

7.0.0

Returns​

RouterBranch[]


empty​

Get Signature​

get empty(): boolean

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:60

Whether or not the branch is empty

Version​

7.0.0

Returns​

boolean


path​

Get Signature​

get path(): string

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:44

The path representing this branch

Version​

7.0.0

Returns​

string

Methods​

_add()​

protected _add(parts: readonly string[], index: number, route: Route): RouterNode

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:107

Parameters​

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns​

RouterNode


_find()​

protected _find(parts: readonly string[], index: number): null | RouterBranch

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:187

Parameters​

ParameterType
partsreadonly string[]
indexnumber

Returns​

null | RouterBranch


_performAdd()​

protected _performAdd(parts: readonly string[], index: number, route: Route): RouterNode

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:119

Parameters​

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns​

RouterNode


_performRemove()​

protected _performRemove(parts: readonly string[], index: number, route: Route): boolean

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:151

Parameters​

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns​

boolean


_remove()​

protected _remove(parts: readonly string[], index: number, route: Route): boolean

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:113

Parameters​

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns​

boolean


_updateSupportedChildrenMethods()​

protected _updateSupportedChildrenMethods(): void

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:200

Returns​

void


find()​

find(parts: readonly string[]): null | RouterBranch

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:71

Tries to find a branch given a path

Parameters​

ParameterTypeDescription
partsreadonly string[]The parts of a path to find a node from

Returns​

null | RouterBranch

The branch found, or null if not found

Version​

7.0.0


matches()​

matches(name: string): boolean

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:82

Checks if the given name matches the branch

Parameters​

ParameterTypeDescription
namestringThe name to match

Returns​

boolean

Whether or not the branch matches the name

Version​

7.0.0


nodes()​

nodes(): IterableIterator<RouterNode>

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:96

Returns​

IterableIterator<RouterNode>


toString()​

toString(): string

Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:92

Returns the string representation of the branch

Returns​

string

The string representation of the branch

Version​

7.0.0