YouTube.js
Guide
Discord
❤️ Sponsor
GitHub
Guide
Discord
❤️ Sponsor
GitHub

youtubei.js / Helpers / ObservedArray

Type Alias: ObservedArray<T>

ObservedArray<T> = T[] & object

Defined in: src/parser/helpers.ts:353

An extended array type that includes additional utility methods for filtering and manipulating YTNode objects.

Type Declaration

NameTypeDescriptionDefined in
first()() => TReturns the first item in the array.src/parser/helpers.ts:406
get()(rule, del_item?) => T | undefinedReturns the first object that matches the specified rule object.src/parser/helpers.ts:360
getAll()(rule, del_items?) => T[]Returns all objects that match the specified rule object.src/parser/helpers.ts:368
matchCondition()(condition) => T | undefinedReturns the first object that satisfies the provided condition function.src/parser/helpers.ts:375
remove()(index) => T[]Removes the item at the specified index.src/parser/helpers.ts:382
as()(...types) => ObservedArray<InstanceType<K[number]>>Similar to filter but with strict type checking. Filters the array to include only items of the specified types. Throws If an item is not of the specified typesrc/parser/helpers.ts:416
filterType()(...types) => ObservedArray<InstanceType<K[number]>>Filters the array to only include items of the specified YTNode types.src/parser/helpers.ts:391
firstOfType()(...types) => InstanceType<K[number]> | undefinedReturns the first item in the array that matches any of the specified YTNode types.src/parser/helpers.ts:400

Type Parameters

T

T extends YTNode = YTNode

Edit this page
Last Updated: 10/18/26, 4:42 AM