elections-types 1.0.71 → 1.0.72
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,5 +1,6 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { ElectionID, OfficeID } from "./Election.js";
|
|
3
|
+
import { Expenditure } from "./FECF24File.js";
|
|
3
4
|
import { FECF3File } from "./FECF3File.js";
|
|
4
5
|
import { StateID } from "./State.js";
|
|
5
6
|
export declare class ActivityIndex {
|
|
@@ -31,6 +32,7 @@ export declare class Candidate {
|
|
|
31
32
|
export declare class CandidateAux extends Candidate {
|
|
32
33
|
readonly committees: CommitteeAux[];
|
|
33
34
|
readonly fec_f3_files: FECF3File[];
|
|
35
|
+
readonly expenditures: Expenditure[];
|
|
34
36
|
constructor(candidate: any);
|
|
35
37
|
static is(candidate: any): candidate is CandidateAux;
|
|
36
38
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { is_election_id, is_office_id } from "./Election.js";
|
|
3
|
+
import { Expenditure } from "./FECF24File.js";
|
|
3
4
|
import { FECF3File } from "./FECF3File.js";
|
|
4
5
|
import { is_state_id } from "./State.js";
|
|
5
6
|
export class ActivityIndex {
|
|
@@ -76,6 +77,7 @@ export class Candidate {
|
|
|
76
77
|
export class CandidateAux extends Candidate {
|
|
77
78
|
committees;
|
|
78
79
|
fec_f3_files;
|
|
80
|
+
expenditures;
|
|
79
81
|
constructor(candidate) {
|
|
80
82
|
if (!CandidateAux.is(candidate)) {
|
|
81
83
|
throw Error("Invalid input.");
|
|
@@ -83,12 +85,15 @@ export class CandidateAux extends Candidate {
|
|
|
83
85
|
super(candidate);
|
|
84
86
|
this.committees = candidate.committees;
|
|
85
87
|
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
|
|
88
|
+
this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure));
|
|
86
89
|
}
|
|
87
90
|
static is(candidate) {
|
|
88
91
|
return (Candidate.is(candidate) &&
|
|
89
92
|
Array.isArray(candidate.committees) &&
|
|
90
93
|
candidate.committees.every(CommitteeAux.is) &&
|
|
91
94
|
Array.isArray(candidate.fec_f3_files) &&
|
|
92
|
-
candidate.fec_f3_files.every(FECF3File.is)
|
|
95
|
+
candidate.fec_f3_files.every(FECF3File.is) &&
|
|
96
|
+
Array.isArray(candidate.expenditures) &&
|
|
97
|
+
candidate.expenditures.every(Expenditure.is));
|
|
93
98
|
}
|
|
94
99
|
}
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Committee, CommitteeAux } from "./Committee"
|
|
2
2
|
import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
|
|
3
|
-
import { FECF24File } from "./FECF24File"
|
|
3
|
+
import { Expenditure, FECF24File } from "./FECF24File"
|
|
4
4
|
import { FECF3File } from "./FECF3File"
|
|
5
5
|
import { FECReport } from "./FECReport"
|
|
6
6
|
import { is_state_id, StateID } from "./State"
|
|
@@ -93,6 +93,7 @@ export class Candidate {
|
|
|
93
93
|
export class CandidateAux extends Candidate {
|
|
94
94
|
readonly committees : CommitteeAux[]
|
|
95
95
|
readonly fec_f3_files : FECF3File[]
|
|
96
|
+
readonly expenditures : Expenditure[]
|
|
96
97
|
|
|
97
98
|
constructor(candidate : any) {
|
|
98
99
|
if (!CandidateAux.is(candidate)) {
|
|
@@ -101,6 +102,7 @@ export class CandidateAux extends Candidate {
|
|
|
101
102
|
super(candidate)
|
|
102
103
|
this.committees = candidate.committees
|
|
103
104
|
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
105
|
+
this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure))
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
static is(candidate : any) : candidate is CandidateAux {
|
|
@@ -109,7 +111,9 @@ export class CandidateAux extends Candidate {
|
|
|
109
111
|
Array.isArray(candidate.committees) &&
|
|
110
112
|
candidate.committees.every(CommitteeAux.is) &&
|
|
111
113
|
Array.isArray(candidate.fec_f3_files) &&
|
|
112
|
-
candidate.fec_f3_files.every(FECF3File.is)
|
|
114
|
+
candidate.fec_f3_files.every(FECF3File.is) &&
|
|
115
|
+
Array.isArray(candidate.expenditures) &&
|
|
116
|
+
candidate.expenditures.every(Expenditure.is)
|
|
113
117
|
)
|
|
114
118
|
}
|
|
115
119
|
}
|