triangle-types 1.0.8 → 1.0.9

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,5 @@
1
1
  import { VoterScore } from "./VoterScore.js";
2
+ import { VoterTurnout } from "./VoterTurnout.js";
2
3
  export declare class Voter {
3
4
  readonly voter_id: string;
4
5
  readonly state_id: string;
@@ -39,6 +40,7 @@ export declare class Voter {
39
40
  }
40
41
  export declare class VoterAux extends Voter {
41
42
  readonly scores: VoterScore[];
43
+ readonly turnouts: VoterTurnout[];
42
44
  constructor(voter: any);
43
45
  static is(voter: any): voter is Voter;
44
46
  }
@@ -1,4 +1,5 @@
1
1
  import { VoterScore } from "./VoterScore.js";
2
+ import { VoterTurnout } from "./VoterTurnout.js";
2
3
  export class Voter {
3
4
  voter_id;
4
5
  state_id;
@@ -110,15 +111,18 @@ export class Voter {
110
111
  }
111
112
  export class VoterAux extends Voter {
112
113
  scores;
114
+ turnouts;
113
115
  constructor(voter) {
114
116
  if (!VoterAux.is(voter)) {
115
117
  throw Error("Invalid input.");
116
118
  }
117
119
  super(voter);
118
120
  this.scores = voter.scores;
121
+ this.turnouts = voter.turnouts;
119
122
  }
120
123
  static is(voter) {
121
124
  return (Voter.is(voter) &&
122
- Array.isArray(voter.scores) && voter.scores.every(VoterScore.is));
125
+ Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
126
+ Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is));
123
127
  }
124
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -1,4 +1,5 @@
1
1
  import { VoterScore } from "./VoterScore"
2
+ import { VoterTurnout } from "./VoterTurnout"
2
3
 
3
4
  export class Voter {
4
5
  readonly voter_id : string
@@ -117,6 +118,7 @@ export class Voter {
117
118
 
118
119
  export class VoterAux extends Voter {
119
120
  readonly scores : VoterScore[]
121
+ readonly turnouts : VoterTurnout[]
120
122
 
121
123
  constructor(voter : any) {
122
124
  if (!VoterAux.is(voter)) {
@@ -124,12 +126,14 @@ export class VoterAux extends Voter {
124
126
  }
125
127
  super(voter)
126
128
  this.scores = voter.scores
129
+ this.turnouts = voter.turnouts
127
130
  }
128
131
 
129
132
  static is(voter : any) : voter is Voter {
130
133
  return (
131
134
  Voter.is(voter) &&
132
- Array.isArray(voter.scores) && voter.scores.every(VoterScore.is)
135
+ Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
136
+ Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is)
133
137
  )
134
138
  }
135
139
  }