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
| Parameter | Type | 
|---|---|
| name | string | 
| dynamic | boolean | 
| parent | null|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
readonlydynamic:boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:14
Whether or not the branch is dynamic.
name
readonlyname:string
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:9
The name of the branch.
node
readonlynode:RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:24
The node this branch is associated with.
parent
readonlyparent: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: readonlystring[],index:number,route:Route):RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:107
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
_find()
protected_find(parts: readonlystring[],index:number):null|RouterBranch
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:187
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
Returns
null | RouterBranch
_performAdd()
protected_performAdd(parts: readonlystring[],index:number,route:Route):RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:119
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
_performRemove()
protected_performRemove(parts: readonlystring[],index:number,route:Route):boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:151
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
boolean
_remove()
protected_remove(parts: readonlystring[],index:number,route:Route):boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:113
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
boolean
_updateSupportedChildrenMethods()
protected_updateSupportedChildrenMethods():void
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:200
Returns
void
find()
find(
parts: readonlystring[]):null|RouterBranch
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:71
Tries to find a branch given a path
Parameters
| Parameter | Type | Description | 
|---|---|---|
| parts | readonly 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
| Parameter | Type | Description | 
|---|---|---|
| name | string | The 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