elections-types 1.0.72 → 1.0.73

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 { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
+ import { Expenditure } from "./FECF24File.js";
3
4
  import { StateID } from "./State.js";
4
5
  declare const office_ids: readonly ["H", "S"];
5
6
  export type OfficeID = typeof office_ids[number];
@@ -19,6 +20,7 @@ export declare class Election {
19
20
  export declare class ElectionAux extends Election {
20
21
  readonly candidates: CandidateAux[];
21
22
  readonly committees: CommitteeAux[];
23
+ readonly expenditures: Expenditure[];
22
24
  constructor(election: any);
23
25
  static is(election: any): election is ElectionAux;
24
26
  }
@@ -1,5 +1,6 @@
1
1
  import { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
+ import { Expenditure } from "./FECF24File.js";
3
4
  import { is_state_id } from "./State.js";
4
5
  const office_ids = ["H", "S"];
5
6
  export function is_office_id(office_id) {
@@ -47,6 +48,7 @@ export class Election {
47
48
  export class ElectionAux extends Election {
48
49
  candidates;
49
50
  committees;
51
+ expenditures;
50
52
  constructor(election) {
51
53
  if (!ElectionAux.is(election)) {
52
54
  throw Error("Invalid input.");
@@ -54,12 +56,15 @@ export class ElectionAux extends Election {
54
56
  super(election);
55
57
  this.candidates = election.candidates;
56
58
  this.committees = election.committees;
59
+ this.expenditures = election.expenditures;
57
60
  }
58
61
  static is(election) {
59
62
  return (Election.is(election) &&
60
63
  Array.isArray(election.candidates) &&
61
64
  election.candidates.every(CandidateAux.is) &&
62
65
  Array.isArray(election.committees) &&
63
- election.committees.every(CommitteeAux.is));
66
+ election.committees.every(CommitteeAux.is) &&
67
+ Array.isArray(election.expenditures) &&
68
+ election.expenditures.every(Expenditure.is));
64
69
  }
65
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -1,5 +1,6 @@
1
1
  import { Candidate, CandidateAux } from "./Candidate"
2
2
  import { Committee, CommitteeAux } from "./Committee"
3
+ import { Expenditure } from "./FECF24File"
3
4
  import { is_state_id, state_ids, StateID } from "./State"
4
5
 
5
6
  const office_ids = ["H", "S"] as const
@@ -64,6 +65,7 @@ export class Election {
64
65
  export class ElectionAux extends Election {
65
66
  readonly candidates : CandidateAux[]
66
67
  readonly committees : CommitteeAux[]
68
+ readonly expenditures : Expenditure[]
67
69
 
68
70
  constructor(election : any) {
69
71
  if (!ElectionAux.is(election)) {
@@ -72,6 +74,7 @@ export class ElectionAux extends Election {
72
74
  super(election)
73
75
  this.candidates = election.candidates
74
76
  this.committees = election.committees
77
+ this.expenditures = election.expenditures
75
78
  }
76
79
 
77
80
  static is(election : any) : election is ElectionAux {
@@ -80,7 +83,9 @@ export class ElectionAux extends Election {
80
83
  Array.isArray(election.candidates) &&
81
84
  election.candidates.every(CandidateAux.is) &&
82
85
  Array.isArray(election.committees) &&
83
- election.committees.every(CommitteeAux.is)
86
+ election.committees.every(CommitteeAux.is) &&
87
+ Array.isArray(election.expenditures) &&
88
+ election.expenditures.every(Expenditure.is)
84
89
  )
85
90
  }
86
91
  }