elections-types 1.0.68 → 1.0.70
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.
|
@@ -19,7 +19,6 @@ export declare class Candidate {
|
|
|
19
19
|
readonly active?: boolean;
|
|
20
20
|
readonly status?: string;
|
|
21
21
|
readonly fec_file_id?: number;
|
|
22
|
-
readonly committee_ids?: string[];
|
|
23
22
|
readonly ballotpedia_name?: string;
|
|
24
23
|
readonly ballotpedia_url?: string;
|
|
25
24
|
readonly ballotpedia_data?: Record<string, any>;
|
|
@@ -31,7 +31,6 @@ export class Candidate {
|
|
|
31
31
|
active;
|
|
32
32
|
status;
|
|
33
33
|
fec_file_id;
|
|
34
|
-
committee_ids;
|
|
35
34
|
ballotpedia_name;
|
|
36
35
|
ballotpedia_url;
|
|
37
36
|
ballotpedia_data;
|
|
@@ -50,7 +49,6 @@ export class Candidate {
|
|
|
50
49
|
this.active = candidate.active;
|
|
51
50
|
this.status = candidate.status;
|
|
52
51
|
this.fec_file_id = candidate.fec_file_id;
|
|
53
|
-
this.committee_ids = candidate.committee_ids;
|
|
54
52
|
this.ballotpedia_name = candidate.ballotpedia_name;
|
|
55
53
|
this.ballotpedia_url = candidate.ballotpedia_url;
|
|
56
54
|
this.ballotpedia_data = candidate.ballotpedia_data;
|
|
@@ -68,7 +66,6 @@ export class Candidate {
|
|
|
68
66
|
(candidate.active === undefined || typeof candidate.active === "boolean") &&
|
|
69
67
|
(candidate.status === undefined || typeof candidate.status === "string") &&
|
|
70
68
|
(candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
|
|
71
|
-
(candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id) => typeof committee_id === "string")) &&
|
|
72
69
|
(candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
|
|
73
70
|
(candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
|
|
74
71
|
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
|
|
@@ -12,7 +12,6 @@ export declare class Election {
|
|
|
12
12
|
readonly office_id: OfficeID;
|
|
13
13
|
readonly state_id: StateID;
|
|
14
14
|
readonly district?: number;
|
|
15
|
-
readonly committee_ids?: string[];
|
|
16
15
|
readonly [x: string]: any;
|
|
17
16
|
constructor(election: Election);
|
|
18
17
|
static is(election: any): election is Election;
|
|
@@ -25,7 +25,6 @@ export class Election {
|
|
|
25
25
|
office_id;
|
|
26
26
|
state_id;
|
|
27
27
|
district;
|
|
28
|
-
committee_ids;
|
|
29
28
|
constructor(election) {
|
|
30
29
|
if (!Election.is(election)) {
|
|
31
30
|
throw Error("Invalid input.");
|
|
@@ -35,7 +34,6 @@ export class Election {
|
|
|
35
34
|
this.office_id = election.office_id;
|
|
36
35
|
this.state_id = election.state_id;
|
|
37
36
|
this.district = election.district;
|
|
38
|
-
this.committee_ids = election.committee_ids;
|
|
39
37
|
}
|
|
40
38
|
static is(election) {
|
|
41
39
|
return (election !== undefined &&
|
|
@@ -43,8 +41,7 @@ export class Election {
|
|
|
43
41
|
typeof election.name === "string" &&
|
|
44
42
|
is_office_id(election.office_id) &&
|
|
45
43
|
is_state_id(election.state_id) &&
|
|
46
|
-
(election.district === undefined || typeof election.district === "number")
|
|
47
|
-
(election.committee_ids === undefined || Array.isArray(election.committee_ids) && election.committee_ids.every((committee_id) => typeof committee_id === "string")));
|
|
44
|
+
(election.district === undefined || typeof election.district === "number"));
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
export class ElectionAux extends Election {
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -40,7 +40,6 @@ export class Candidate {
|
|
|
40
40
|
readonly active? : boolean
|
|
41
41
|
readonly status? : string
|
|
42
42
|
readonly fec_file_id? : number
|
|
43
|
-
readonly committee_ids? : string[]
|
|
44
43
|
readonly ballotpedia_name? : string
|
|
45
44
|
readonly ballotpedia_url? : string
|
|
46
45
|
readonly ballotpedia_data? : Record<string, any>
|
|
@@ -64,7 +63,6 @@ export class Candidate {
|
|
|
64
63
|
this.active = candidate.active
|
|
65
64
|
this.status = candidate.status
|
|
66
65
|
this.fec_file_id = candidate.fec_file_id
|
|
67
|
-
this.committee_ids = candidate.committee_ids
|
|
68
66
|
this.ballotpedia_name = candidate.ballotpedia_name
|
|
69
67
|
this.ballotpedia_url = candidate.ballotpedia_url
|
|
70
68
|
this.ballotpedia_data = candidate.ballotpedia_data
|
|
@@ -84,7 +82,6 @@ export class Candidate {
|
|
|
84
82
|
(candidate.active === undefined || typeof candidate.active === "boolean") &&
|
|
85
83
|
(candidate.status === undefined || typeof candidate.status === "string") &&
|
|
86
84
|
(candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
|
|
87
|
-
(candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
|
|
88
85
|
(candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
|
|
89
86
|
(candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
|
|
90
87
|
(candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
|
package/src/types/Election.ts
CHANGED
|
@@ -36,7 +36,6 @@ export class Election {
|
|
|
36
36
|
readonly office_id : OfficeID
|
|
37
37
|
readonly state_id : StateID
|
|
38
38
|
readonly district? : number
|
|
39
|
-
readonly committee_ids? : string[]
|
|
40
39
|
readonly [x : string] : any
|
|
41
40
|
|
|
42
41
|
constructor(election : Election) {
|
|
@@ -48,7 +47,6 @@ export class Election {
|
|
|
48
47
|
this.office_id = election.office_id
|
|
49
48
|
this.state_id = election.state_id
|
|
50
49
|
this.district = election.district
|
|
51
|
-
this.committee_ids = election.committee_ids
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
static is(election : any) : election is Election {
|
|
@@ -58,8 +56,7 @@ export class Election {
|
|
|
58
56
|
typeof election.name === "string" &&
|
|
59
57
|
is_office_id(election.office_id) &&
|
|
60
58
|
is_state_id(election.state_id) &&
|
|
61
|
-
(election.district === undefined || typeof election.district === "number")
|
|
62
|
-
(election.committee_ids === undefined || Array.isArray(election.committee_ids) && election.committee_ids.every((committee_id : any) => typeof committee_id === "string"))
|
|
59
|
+
(election.district === undefined || typeof election.district === "number")
|
|
63
60
|
)
|
|
64
61
|
}
|
|
65
62
|
}
|