Verified Commit 8508d65a authored by Jules Sagot--Gentil's avatar Jules Sagot--Gentil
Browse files

feat(article): implémentation de la méthode egal/getId d'ArticleRSS

parent 0f365f06
......@@ -4,6 +4,7 @@ import { Writable } from 'stream';
export interface Article {
affiche(sortie: Writable): void;
egal(autreArticle: Article): boolean;
getId(): string | undefined;
}
export class ArticleRSS implements Article {
......@@ -25,5 +26,14 @@ export class ArticleRSS implements Article {
sortie.write(`\n`);
}
egal(autreArticle: Article) { return false };
egal(autreArticle: Article) {
if (autreArticle.getId() == undefined || this.getId() == undefined) {
return false;
}
return autreArticle.getId() == this.getId();
};
public getId(): string | undefined {
return this.item.guid || this.item.link || this.item.content;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment