youtubei.js / Helpers / ObservedArray
Type Alias: ObservedArray<T>
ObservedArray<
T
>:T
[] &object
Type declaration
first()
first: () =>
T
Get the first item.
Returns
T
get()
get: (
rule
,del_item
?) =>T
|undefined
Returns the first object to match the rule.
Parameters
• rule: object
• del_item?: boolean
Returns
T
| undefined
getAll()
getAll: (
rule
,del_items
?) =>T
[]
Returns all objects that match the rule.
Parameters
• rule: object
• del_items?: boolean
Returns
T
[]
matchCondition()
matchCondition: (
condition
) =>T
|undefined
Returns the first object to match the condition.
Parameters
• condition
Returns
T
| undefined
remove()
remove: (
index
) =>T
[]
Removes the item at the given index.
Parameters
• index: number
Returns
T
[]
as()
This is similar to filter but throws if there's a type mismatch.
Type Parameters
• R extends YTNode
• K extends YTNodeConstructor
<R
>[]
Parameters
• ...types: K
Returns
ObservedArray
<InstanceType
<K
[number
]>>
filterType()
Get all items of a specific type.
Type Parameters
• R extends YTNode
• K extends YTNodeConstructor
<R
>[]
Parameters
• ...types: K
Returns
ObservedArray
<InstanceType
<K
[number
]>>
firstOfType()
Get the first of a specific type.
Type Parameters
• R extends YTNode
• K extends YTNodeConstructor
<R
>[]
Parameters
• ...types: K
Returns
undefined
| InstanceType
<K
[number
]>