Files
YouTube.js/src/parser/classes/Grid.ts
LuanRT aa334aacbd refactor: clean up, fix & remove outdated code (#228)
* dev: refactor and remove redundant code

* docs(music): update `Library` API ref

* docs: update examples

* chore: update lock file
2022-11-06 03:32:16 -03:00

44 lines
867 B
TypeScript

import Parser from '../index';
import { YTNode } from '../helpers';
class Grid extends YTNode {
static type = 'Grid';
items;
is_collapsible?: boolean;
visible_row_count?: string;
target_id?: string;
continuation: string | null;
header?;
constructor(data: any) {
super();
this.items = Parser.parseArray(data.items);
if (data.header) {
this.header = Parser.parse(data.header);
}
if (data.isCollapsible) {
this.is_collapsible = data.isCollapsible;
}
if (data.visibleRowCount) {
this.visible_row_count = data.visibleRowCount;
}
if (data.targetId) {
this.target_id = data.targetId;
}
this.continuation = data.continuations?.[0]?.nextContinuationData?.continuation || null;
}
// XXX: alias for consistency
get contents() {
return this.items;
}
}
export default Grid;