Files
YouTube.js/lib/parser/contents/classes/Shelf.js
Bob Varioa 0a851bde31 refactor: remove confusing code practices (#87)
* Prefer `c ? x : y` over `c && x || y`

* Avoid unnecessary asssignment expressions

* Prefer switch statements over object lookup tables

* Add an .editorconfig

* Fix style issues

* Fix mentioned issues

Co-authored-by: bob <bob.varioa@gmail.com>
2022-07-01 19:37:59 -03:00

29 lines
575 B
JavaScript

'use strict';
const Text = require('./Text');
const Parser = require('..');
const NavigationEndpoint = require('./NavigationEndpoint');
class Shelf {
type = 'Shelf';
constructor(data) {
this.title = new Text(data.title);
if (data.endpoint) {
this.endpoint = new NavigationEndpoint(data.endpoint)
}
this.content = Parser.parse(data.content) || [];
if (data.icon?.iconType) {
this.icon_type = data.icon?.iconType
}
if (data.menu) {
this.menu = Parser.parse(data.menu)
}
}
}
module.exports = Shelf;