elections-types 1.0.70 → 1.0.71

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 { FECF3File } from "./FECF3File.js";
3
4
  import { StateID } from "./State.js";
4
5
  export declare class ActivityIndex {
5
6
  readonly news_index: number;
@@ -29,6 +30,7 @@ export declare class Candidate {
29
30
  }
30
31
  export declare class CandidateAux extends Candidate {
31
32
  readonly committees: CommitteeAux[];
33
+ readonly fec_f3_files: FECF3File[];
32
34
  constructor(candidate: any);
33
35
  static is(candidate: any): candidate is CandidateAux;
34
36
  }
@@ -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 { FECF3File } from "./FECF3File.js";
3
4
  import { is_state_id } from "./State.js";
4
5
  export class ActivityIndex {
5
6
  news_index;
@@ -74,18 +75,20 @@ export class Candidate {
74
75
  }
75
76
  export class CandidateAux extends Candidate {
76
77
  committees;
77
- // readonly fec_f3_files : FECF3File[]
78
+ fec_f3_files;
78
79
  constructor(candidate) {
79
80
  if (!CandidateAux.is(candidate)) {
80
81
  throw Error("Invalid input.");
81
82
  }
82
83
  super(candidate);
83
84
  this.committees = candidate.committees;
84
- // this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
85
+ this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
85
86
  }
86
87
  static is(candidate) {
87
88
  return (Candidate.is(candidate) &&
88
89
  Array.isArray(candidate.committees) &&
89
- candidate.committees.every(CommitteeAux.is));
90
+ candidate.committees.every(CommitteeAux.is) &&
91
+ Array.isArray(candidate.fec_f3_files) &&
92
+ candidate.fec_f3_files.every(FECF3File.is));
90
93
  }
91
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -92,7 +92,7 @@ export class Candidate {
92
92
 
93
93
  export class CandidateAux extends Candidate {
94
94
  readonly committees : CommitteeAux[]
95
- // readonly fec_f3_files : FECF3File[]
95
+ readonly fec_f3_files : FECF3File[]
96
96
 
97
97
  constructor(candidate : any) {
98
98
  if (!CandidateAux.is(candidate)) {
@@ -100,14 +100,16 @@ export class CandidateAux extends Candidate {
100
100
  }
101
101
  super(candidate)
102
102
  this.committees = candidate.committees
103
- // this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
103
+ this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
104
104
  }
105
105
 
106
106
  static is(candidate : any) : candidate is CandidateAux {
107
107
  return (
108
108
  Candidate.is(candidate) &&
109
109
  Array.isArray(candidate.committees) &&
110
- candidate.committees.every(CommitteeAux.is)
110
+ candidate.committees.every(CommitteeAux.is) &&
111
+ Array.isArray(candidate.fec_f3_files) &&
112
+ candidate.fec_f3_files.every(FECF3File.is)
111
113
  )
112
114
  }
113
115
  }