@publidata/utils-data-manager
Version:
Collection of methods to extract data from publidata
32 lines (26 loc) • 667 B
JavaScript
const PublidataPostObject = require("../");
/**
* Class representing a News object.
* @extends PublidataPostObject
* @param {Object} object - The object from the Publidata API
*/
class PublidataObjectNews extends PublidataPostObject {
get title() {
return this.memoize("title", this.object._source.name);
}
get date() {
return this.memoize("date", this.object._source.release_date);
}
get page() {
return this.memoize("page", this.object._source.pages?.[0]);
}
toJSON() {
return {
...super.toJSON(),
title: this.title,
date: this.date,
page: this.page,
};
}
}
module.exports = PublidataObjectNews;