elections-types 1.0.43 → 1.0.45
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { ElectionID, OfficeID } from "./Election.js";
|
|
3
3
|
import { FECReport } from "./FECReport.js";
|
|
4
4
|
import { StateID } from "./State.js";
|
|
@@ -14,6 +14,7 @@ export declare class Candidate {
|
|
|
14
14
|
readonly fec_name: string;
|
|
15
15
|
readonly office_id: OfficeID;
|
|
16
16
|
readonly state_id: StateID;
|
|
17
|
+
readonly district?: number;
|
|
17
18
|
readonly election_id: ElectionID;
|
|
18
19
|
readonly party_id?: string;
|
|
19
20
|
readonly active?: boolean;
|
|
@@ -33,7 +34,7 @@ export declare class Candidate {
|
|
|
33
34
|
static is(candidate: any): candidate is Candidate;
|
|
34
35
|
}
|
|
35
36
|
export declare class CandidateAux extends Candidate {
|
|
36
|
-
readonly committees:
|
|
37
|
+
readonly committees: CommitteeAux[];
|
|
37
38
|
readonly fec_reports: FECReport[];
|
|
38
39
|
constructor(candidate: any);
|
|
39
40
|
static is(candidate: any): candidate is CandidateAux;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { is_election_id, is_office_id } from "./Election.js";
|
|
3
3
|
import { FECReport } from "./FECReport.js";
|
|
4
4
|
import { is_state_id } from "./State.js";
|
|
@@ -26,6 +26,7 @@ export class Candidate {
|
|
|
26
26
|
fec_name;
|
|
27
27
|
office_id;
|
|
28
28
|
state_id;
|
|
29
|
+
district;
|
|
29
30
|
election_id;
|
|
30
31
|
party_id;
|
|
31
32
|
active;
|
|
@@ -48,6 +49,7 @@ export class Candidate {
|
|
|
48
49
|
this.fec_name = candidate.fec_name;
|
|
49
50
|
this.office_id = candidate.office_id;
|
|
50
51
|
this.state_id = candidate.state_id;
|
|
52
|
+
this.district = candidate.district;
|
|
51
53
|
this.election_id = candidate.election_id;
|
|
52
54
|
this.party_id = candidate.party_id;
|
|
53
55
|
this.active = candidate.active;
|
|
@@ -69,6 +71,7 @@ export class Candidate {
|
|
|
69
71
|
typeof candidate.fec_name === "string" &&
|
|
70
72
|
is_office_id(candidate.office_id) &&
|
|
71
73
|
is_state_id(candidate.state_id) &&
|
|
74
|
+
typeof candidate.district === "number" &&
|
|
72
75
|
is_election_id(candidate.election_id) &&
|
|
73
76
|
(candidate.party_id === undefined || typeof candidate.party_id === "string") &&
|
|
74
77
|
(candidate.active === undefined || typeof candidate.active === "boolean") &&
|
|
@@ -99,7 +102,7 @@ export class CandidateAux extends Candidate {
|
|
|
99
102
|
static is(candidate) {
|
|
100
103
|
return (Candidate.is(candidate) &&
|
|
101
104
|
Array.isArray(candidate.committees) &&
|
|
102
|
-
candidate.committees.every(
|
|
105
|
+
candidate.committees.every(CommitteeAux.is) &&
|
|
103
106
|
Array.isArray(candidate.fec_reports) &&
|
|
104
107
|
candidate.fec_reports.every(FECReport.is));
|
|
105
108
|
}
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Committee } from "./Committee"
|
|
1
|
+
import { Committee, CommitteeAux } from "./Committee"
|
|
2
2
|
import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
|
|
3
3
|
import { FECReport } from "./FECReport"
|
|
4
4
|
import { is_state_id, StateID } from "./State"
|
|
@@ -32,6 +32,7 @@ export class Candidate {
|
|
|
32
32
|
readonly fec_name : string
|
|
33
33
|
readonly office_id : OfficeID
|
|
34
34
|
readonly state_id : StateID
|
|
35
|
+
readonly district? : number
|
|
35
36
|
readonly election_id : ElectionID
|
|
36
37
|
readonly party_id? : string
|
|
37
38
|
readonly active? : boolean
|
|
@@ -59,6 +60,7 @@ export class Candidate {
|
|
|
59
60
|
this.fec_name = candidate.fec_name
|
|
60
61
|
this.office_id = candidate.office_id
|
|
61
62
|
this.state_id = candidate.state_id
|
|
63
|
+
this.district = candidate.district
|
|
62
64
|
this.election_id = candidate.election_id
|
|
63
65
|
this.party_id = candidate.party_id
|
|
64
66
|
this.active = candidate.active
|
|
@@ -82,6 +84,7 @@ export class Candidate {
|
|
|
82
84
|
typeof candidate.fec_name === "string" &&
|
|
83
85
|
is_office_id(candidate.office_id) &&
|
|
84
86
|
is_state_id(candidate.state_id) &&
|
|
87
|
+
typeof candidate.district === "number" &&
|
|
85
88
|
is_election_id(candidate.election_id) &&
|
|
86
89
|
(candidate.party_id === undefined || typeof candidate.party_id === "string") &&
|
|
87
90
|
(candidate.active === undefined || typeof candidate.active === "boolean") &&
|
|
@@ -101,7 +104,7 @@ export class Candidate {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
export class CandidateAux extends Candidate {
|
|
104
|
-
readonly committees :
|
|
107
|
+
readonly committees : CommitteeAux[]
|
|
105
108
|
readonly fec_reports : FECReport[]
|
|
106
109
|
|
|
107
110
|
constructor(candidate : any) {
|
|
@@ -117,7 +120,7 @@ export class CandidateAux extends Candidate {
|
|
|
117
120
|
return (
|
|
118
121
|
Candidate.is(candidate) &&
|
|
119
122
|
Array.isArray(candidate.committees) &&
|
|
120
|
-
candidate.committees.every(
|
|
123
|
+
candidate.committees.every(CommitteeAux.is) &&
|
|
121
124
|
Array.isArray(candidate.fec_reports) &&
|
|
122
125
|
candidate.fec_reports.every(FECReport.is)
|
|
123
126
|
)
|