triangle-types 1.0.50 → 1.0.52
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.
- package/dist/src/types/prism/UserPrism.d.ts +0 -1
- package/dist/src/types/prism/UserPrism.js +1 -4
- package/dist/src/types/prism/Voter.d.ts +8 -0
- package/dist/src/types/prism/Voter.js +19 -19
- package/package.json +1 -1
- package/src/types/prism/UserPrism.ts +1 -4
- package/src/types/prism/Voter.ts +22 -19
|
@@ -2,7 +2,6 @@ export class UserPrism {
|
|
|
2
2
|
user_prism_id;
|
|
3
3
|
user_id;
|
|
4
4
|
prism_id;
|
|
5
|
-
target_id;
|
|
6
5
|
constructor(user_prism) {
|
|
7
6
|
if (!UserPrism.is(user_prism)) {
|
|
8
7
|
throw Error("Invalid input.");
|
|
@@ -10,13 +9,11 @@ export class UserPrism {
|
|
|
10
9
|
this.user_prism_id = user_prism.user_prism_id;
|
|
11
10
|
this.user_id = user_prism.user_id;
|
|
12
11
|
this.prism_id = user_prism.prism_id;
|
|
13
|
-
this.target_id = user_prism.target_id;
|
|
14
12
|
}
|
|
15
13
|
static is(user_prism) {
|
|
16
14
|
return (user_prism !== undefined &&
|
|
17
15
|
typeof user_prism.user_prism_id === "string" &&
|
|
18
16
|
typeof user_prism.user_id === "string" &&
|
|
19
|
-
typeof user_prism.prism_id === "string"
|
|
20
|
-
typeof user_prism.target_id === "string");
|
|
17
|
+
typeof user_prism.prism_id === "string");
|
|
21
18
|
}
|
|
22
19
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VoterTarget } from "./VoterTarget.js";
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout.js";
|
|
1
3
|
export declare class Voter {
|
|
2
4
|
readonly voter_id: string;
|
|
3
5
|
readonly state_id: string;
|
|
@@ -40,3 +42,9 @@ export declare class Voter {
|
|
|
40
42
|
constructor(voter: any);
|
|
41
43
|
static is(voter: any): voter is Voter;
|
|
42
44
|
}
|
|
45
|
+
export declare class VoterAux extends Voter {
|
|
46
|
+
readonly targets: VoterTarget[];
|
|
47
|
+
readonly turnouts: VoterTurnout[];
|
|
48
|
+
constructor(voter: any);
|
|
49
|
+
static is(voter: any): voter is Voter;
|
|
50
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VoterTarget } from "./VoterTarget.js";
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout.js";
|
|
1
3
|
export class Voter {
|
|
2
4
|
voter_id;
|
|
3
5
|
state_id;
|
|
@@ -119,22 +121,20 @@ export class Voter {
|
|
|
119
121
|
(voter.marital_status === undefined || typeof voter.marital_status === "string"));
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// }
|
|
140
|
-
// }
|
|
124
|
+
export class VoterAux extends Voter {
|
|
125
|
+
targets;
|
|
126
|
+
turnouts;
|
|
127
|
+
constructor(voter) {
|
|
128
|
+
if (!VoterAux.is(voter)) {
|
|
129
|
+
throw Error("Invalid input.");
|
|
130
|
+
}
|
|
131
|
+
super(voter);
|
|
132
|
+
this.targets = voter.targets;
|
|
133
|
+
this.turnouts = voter.turnouts;
|
|
134
|
+
}
|
|
135
|
+
static is(voter) {
|
|
136
|
+
return (Voter.is(voter) &&
|
|
137
|
+
Array.isArray(voter.targets) && voter.targets.every(VoterTarget.is) &&
|
|
138
|
+
Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is));
|
|
139
|
+
}
|
|
140
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ export class UserPrism {
|
|
|
2
2
|
readonly user_prism_id : string
|
|
3
3
|
readonly user_id : string
|
|
4
4
|
readonly prism_id : string
|
|
5
|
-
readonly target_id : string
|
|
6
5
|
|
|
7
6
|
constructor(user_prism : any) {
|
|
8
7
|
if (!UserPrism.is(user_prism)) {
|
|
@@ -11,7 +10,6 @@ export class UserPrism {
|
|
|
11
10
|
this.user_prism_id = user_prism.user_prism_id
|
|
12
11
|
this.user_id = user_prism.user_id
|
|
13
12
|
this.prism_id = user_prism.prism_id
|
|
14
|
-
this.target_id = user_prism.target_id
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
static is(user_prism : any) : user_prism is UserPrism {
|
|
@@ -19,8 +17,7 @@ export class UserPrism {
|
|
|
19
17
|
user_prism !== undefined &&
|
|
20
18
|
typeof user_prism.user_prism_id === "string" &&
|
|
21
19
|
typeof user_prism.user_id === "string" &&
|
|
22
|
-
typeof user_prism.prism_id === "string"
|
|
23
|
-
typeof user_prism.target_id === "string"
|
|
20
|
+
typeof user_prism.prism_id === "string"
|
|
24
21
|
)
|
|
25
22
|
}
|
|
26
23
|
}
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { VoterTarget } from "./VoterTarget"
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout"
|
|
3
|
+
|
|
1
4
|
export class Voter {
|
|
2
5
|
readonly voter_id : string
|
|
3
6
|
readonly state_id : string
|
|
@@ -125,24 +128,24 @@ export class Voter {
|
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
export class VoterAux extends Voter {
|
|
132
|
+
readonly targets : VoterTarget[]
|
|
133
|
+
readonly turnouts : VoterTurnout[]
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
constructor(voter : any) {
|
|
136
|
+
if (!VoterAux.is(voter)) {
|
|
137
|
+
throw Error("Invalid input.")
|
|
138
|
+
}
|
|
139
|
+
super(voter)
|
|
140
|
+
this.targets = voter.targets
|
|
141
|
+
this.turnouts = voter.turnouts
|
|
142
|
+
}
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
static is(voter : any) : voter is Voter {
|
|
145
|
+
return (
|
|
146
|
+
Voter.is(voter) &&
|
|
147
|
+
Array.isArray(voter.targets) && voter.targets.every(VoterTarget.is) &&
|
|
148
|
+
Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is)
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
}
|