elections-types 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,6 +25,7 @@ export declare class Candidate {
|
|
|
25
25
|
readonly ballotpedia_name?: string;
|
|
26
26
|
readonly ballotpedia_url?: string;
|
|
27
27
|
readonly ballotpedia_data?: Record<string, any>;
|
|
28
|
+
readonly activity_index?: ActivityIndex;
|
|
28
29
|
constructor(candidate: any);
|
|
29
30
|
static is(candidate: any): candidate is Candidate;
|
|
30
31
|
}
|
|
@@ -37,6 +37,7 @@ export class Candidate {
|
|
|
37
37
|
ballotpedia_name;
|
|
38
38
|
ballotpedia_url;
|
|
39
39
|
ballotpedia_data;
|
|
40
|
+
activity_index;
|
|
40
41
|
// readonly urls? : string[]
|
|
41
42
|
// readonly previews? : string[]
|
|
42
43
|
constructor(candidate) {
|
|
@@ -60,6 +61,7 @@ export class Candidate {
|
|
|
60
61
|
this.ballotpedia_name = candidate.ballotpedia_name;
|
|
61
62
|
this.ballotpedia_url = candidate.ballotpedia_url;
|
|
62
63
|
this.ballotpedia_data = candidate.ballotpedia_data;
|
|
64
|
+
this.activity_index = new ActivityIndex(candidate.activity_index);
|
|
63
65
|
}
|
|
64
66
|
static is(candidate) {
|
|
65
67
|
return (candidate !== undefined &&
|
|
@@ -79,6 +81,7 @@ export class Candidate {
|
|
|
79
81
|
(candidate.expenditure_ids === undefined || Array.isArray(candidate.expenditure_ids) && candidate.expenditure_ids.map((committee_id) => typeof committee_id === "string")) &&
|
|
80
82
|
(candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
|
|
81
83
|
(candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
|
|
82
|
-
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key) => typeof key === "string"))
|
|
84
|
+
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
|
|
85
|
+
(candidate.activity_index === undefined || ActivityIndex.is(candidate.activity_index)));
|
|
83
86
|
}
|
|
84
87
|
}
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -43,6 +43,7 @@ export class Candidate {
|
|
|
43
43
|
readonly ballotpedia_name? : string
|
|
44
44
|
readonly ballotpedia_url? : string
|
|
45
45
|
readonly ballotpedia_data? : Record<string, any>
|
|
46
|
+
readonly activity_index? : ActivityIndex
|
|
46
47
|
// readonly urls? : string[]
|
|
47
48
|
// readonly previews? : string[]
|
|
48
49
|
|
|
@@ -68,6 +69,7 @@ export class Candidate {
|
|
|
68
69
|
this.ballotpedia_name = candidate.ballotpedia_name
|
|
69
70
|
this.ballotpedia_url = candidate.ballotpedia_url
|
|
70
71
|
this.ballotpedia_data = candidate.ballotpedia_data
|
|
72
|
+
this.activity_index = new ActivityIndex(candidate.activity_index)
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
static is(candidate : any) : candidate is Candidate {
|
|
@@ -89,7 +91,8 @@ export class Candidate {
|
|
|
89
91
|
(candidate.expenditure_ids === undefined || Array.isArray(candidate.expenditure_ids) && candidate.expenditure_ids.map((committee_id : any) => typeof committee_id === "string")) &&
|
|
90
92
|
(candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
|
|
91
93
|
(candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
|
|
92
|
-
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string"))
|
|
94
|
+
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
|
|
95
|
+
(candidate.activity_index === undefined || ActivityIndex.is(candidate.activity_index))
|
|
93
96
|
)
|
|
94
97
|
}
|
|
95
98
|
}
|