triangle-types 1.0.6 → 1.0.7

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.
@@ -59,3 +59,4 @@ export * from "./types/state_permits/WI/WIStatePermit.js";
59
59
  export * from "./types/state_permits/WI/WIStatePermitDocument.js";
60
60
  export * from "./types/voters/Voter.js";
61
61
  export * from "./types/voters/VoterScore.js";
62
+ export * from "./types/voters/VoterTurnout.js";
package/dist/src/index.js CHANGED
@@ -59,3 +59,4 @@ export * from "./types/state_permits/WI/WIStatePermit.js";
59
59
  export * from "./types/state_permits/WI/WIStatePermitDocument.js";
60
60
  export * from "./types/voters/Voter.js";
61
61
  export * from "./types/voters/VoterScore.js";
62
+ export * from "./types/voters/VoterTurnout.js";
@@ -0,0 +1,11 @@
1
+ export declare class VoterTurnout {
2
+ readonly voter_turnout_id: string;
3
+ readonly voter_id: string;
4
+ readonly turnout_id: string;
5
+ readonly year: number;
6
+ readonly state_id: string;
7
+ readonly turnout_type_id: string;
8
+ readonly value?: boolean;
9
+ constructor(voter_turnout: any);
10
+ static is(voter_turnout: any): voter_turnout is VoterTurnout;
11
+ }
@@ -0,0 +1,31 @@
1
+ export class VoterTurnout {
2
+ voter_turnout_id;
3
+ voter_id;
4
+ turnout_id;
5
+ year;
6
+ state_id;
7
+ turnout_type_id;
8
+ value;
9
+ constructor(voter_turnout) {
10
+ if (!VoterTurnout.is(voter_turnout)) {
11
+ throw Error("Invalid input.");
12
+ }
13
+ this.voter_turnout_id = voter_turnout.voter_turnout_id;
14
+ this.voter_id = voter_turnout.voter_id;
15
+ this.turnout_id = voter_turnout.turnout_id;
16
+ this.year = voter_turnout.year;
17
+ this.state_id = voter_turnout.state_id;
18
+ this.turnout_type_id = voter_turnout.turnout_type_id;
19
+ this.value = voter_turnout.value;
20
+ }
21
+ static is(voter_turnout) {
22
+ return (voter_turnout !== undefined &&
23
+ typeof voter_turnout.voter_turnout_id === "string" &&
24
+ typeof voter_turnout.voter_id === "string" &&
25
+ typeof voter_turnout.turnout_id === "string" &&
26
+ typeof voter_turnout.year === "number" &&
27
+ typeof voter_turnout.state_id === "string" &&
28
+ typeof voter_turnout.turnout_type_id === "string" &&
29
+ (voter_turnout.value === undefined || typeof voter_turnout.value === "boolean"));
30
+ }
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -72,4 +72,5 @@ export * from "./types/state_permits/WI/WIStatePermit"
72
72
  export * from "./types/state_permits/WI/WIStatePermitDocument"
73
73
 
74
74
  export * from "./types/voters/Voter"
75
- export * from "./types/voters/VoterScore"
75
+ export * from "./types/voters/VoterScore"
76
+ export * from "./types/voters/VoterTurnout"
@@ -0,0 +1,35 @@
1
+ export class VoterTurnout {
2
+ readonly voter_turnout_id : string
3
+ readonly voter_id : string
4
+ readonly turnout_id : string
5
+ readonly year : number
6
+ readonly state_id : string
7
+ readonly turnout_type_id : string
8
+ readonly value? : boolean
9
+
10
+ constructor(voter_turnout : any) {
11
+ if (!VoterTurnout.is(voter_turnout)) {
12
+ throw Error("Invalid input.")
13
+ }
14
+ this.voter_turnout_id = voter_turnout.voter_turnout_id
15
+ this.voter_id = voter_turnout.voter_id
16
+ this.turnout_id = voter_turnout.turnout_id
17
+ this.year = voter_turnout.year
18
+ this.state_id = voter_turnout.state_id
19
+ this.turnout_type_id = voter_turnout.turnout_type_id
20
+ this.value = voter_turnout.value
21
+ }
22
+
23
+ static is(voter_turnout : any) : voter_turnout is VoterTurnout {
24
+ return (
25
+ voter_turnout !== undefined &&
26
+ typeof voter_turnout.voter_turnout_id === "string" &&
27
+ typeof voter_turnout.voter_id === "string" &&
28
+ typeof voter_turnout.turnout_id === "string" &&
29
+ typeof voter_turnout.year === "number" &&
30
+ typeof voter_turnout.state_id === "string" &&
31
+ typeof voter_turnout.turnout_type_id === "string" &&
32
+ (voter_turnout.value === undefined || typeof voter_turnout.value === "boolean")
33
+ )
34
+ }
35
+ }