-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSerItem.ts
43 lines (40 loc) · 1.09 KB
/
JSerItem.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// LICENSE : MIT
"use strict";
import * as assert from "assert";
import RelatedLink from "./JSerItemRelatedLink";
export class JSerItem {
title: string;
url: string;
content: string;
tags: string[];
date: Date;
relatedLinks: {
title: string;
url: string;
}[];
constructor(item: any) {
/** @type {string} */
this.title = item["title"];
/** @type {string} */
this.url = item["url"];
/** @type {string} */
this.content = item["content"];
/** @type {string[]} */
this.tags = item["tags"] || [];
/** @type {Date} */
this.date = new Date(item["date"]);
var relatedLinks = item["relatedLinks"] || [];
/** @type {JSerItemRelatedLink[]} */
this.relatedLinks = relatedLinks.map(function (link: any) {
return new RelatedLink(link);
});
}
/**
* @param {JSerItem} item
* @returns {boolean}
*/
isEqualItem(item: JSerItem) {
assert(item != null, "item should not be null");
return this.url === item.url;
}
}