Files
YouTube.js/lib/parser/contents/classes/LikeButton.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

22 lines
465 B
JavaScript

'use strict';
const NavigationEndpoint = require('./NavigationEndpoint');
class LikeButton {
type = 'LikeButton';
constructor(data) {
this.target = {
video_id: data.target.videoId
};
this.like_status = data.likeStatus;
this.likes_allowed = data.likesAllowed;
if (data.serviceEndpoints) {
this.endpoints = data.serviceEndpoints?.map((endpoint) => new NavigationEndpoint(endpoint))
}
}
}
module.exports = LikeButton;