triangle-types 1.0.47 → 1.0.49
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/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/prism/PrismSubPrism.d.ts +7 -0
- package/dist/src/types/prism/PrismSubPrism.js +16 -0
- package/dist/src/types/prism/Voter.d.ts +4 -4
- package/dist/src/types/prism/Voter.js +4 -4
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/prism/PrismSubPrism.ts +21 -0
- package/src/types/prism/Voter.ts +8 -8
package/dist/src/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export * from "./types/legistar/LegistarDocument.js";
|
|
|
46
46
|
export * from "./types/prism/Prism.js";
|
|
47
47
|
export * from "./types/prism/PrismMetric.js";
|
|
48
48
|
export * from "./types/prism/PrismVoter.js";
|
|
49
|
+
export * from "./types/prism/PrismSubPrism.js";
|
|
49
50
|
export * from "./types/prism/UserPrism.js";
|
|
50
51
|
export * from "./types/prism/Voter.js";
|
|
51
52
|
export * from "./types/prism/VoterTurnout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -46,6 +46,7 @@ export * from "./types/legistar/LegistarDocument.js";
|
|
|
46
46
|
export * from "./types/prism/Prism.js";
|
|
47
47
|
export * from "./types/prism/PrismMetric.js";
|
|
48
48
|
export * from "./types/prism/PrismVoter.js";
|
|
49
|
+
export * from "./types/prism/PrismSubPrism.js";
|
|
49
50
|
export * from "./types/prism/UserPrism.js";
|
|
50
51
|
export * from "./types/prism/Voter.js";
|
|
51
52
|
export * from "./types/prism/VoterTurnout.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class PrismSubPrism {
|
|
2
|
+
prism_id;
|
|
3
|
+
sub_prism_id;
|
|
4
|
+
constructor(prism_sub_prism) {
|
|
5
|
+
if (!PrismSubPrism.is(prism_sub_prism)) {
|
|
6
|
+
throw Error("Invalid input.");
|
|
7
|
+
}
|
|
8
|
+
this.prism_id = prism_sub_prism.prism_id;
|
|
9
|
+
this.sub_prism_id = prism_sub_prism.sub_prism_id;
|
|
10
|
+
}
|
|
11
|
+
static is(prism_sub_prism) {
|
|
12
|
+
return (prism_sub_prism !== undefined &&
|
|
13
|
+
typeof prism_sub_prism.prism_id === "string" &&
|
|
14
|
+
typeof prism_sub_prism.sub_prism_id === "string");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -11,16 +11,16 @@ export declare class Voter {
|
|
|
11
11
|
readonly birth_date?: string;
|
|
12
12
|
readonly address_residence_1: string;
|
|
13
13
|
readonly address_residence_2?: string;
|
|
14
|
-
readonly address_residence_city
|
|
14
|
+
readonly address_residence_city?: string;
|
|
15
15
|
readonly address_residence_state_id: string;
|
|
16
|
-
readonly address_residence_zip
|
|
16
|
+
readonly address_residence_zip?: string;
|
|
17
17
|
readonly address_residence_latitude: number;
|
|
18
18
|
readonly address_residence_longitude: number;
|
|
19
19
|
readonly address_mail_1: string;
|
|
20
20
|
readonly address_mail_2?: string;
|
|
21
|
-
readonly address_mail_city
|
|
21
|
+
readonly address_mail_city?: string;
|
|
22
22
|
readonly address_mail_state_id: string;
|
|
23
|
-
readonly address_mail_zip
|
|
23
|
+
readonly address_mail_zip?: string;
|
|
24
24
|
readonly federal_house_district: number;
|
|
25
25
|
readonly state_house_district: number;
|
|
26
26
|
readonly state_senate_district: number;
|
|
@@ -92,16 +92,16 @@ export class Voter {
|
|
|
92
92
|
(voter.birth_date === undefined || typeof voter.birth_date === "string") &&
|
|
93
93
|
typeof voter.address_residence_1 === "string" &&
|
|
94
94
|
(voter.address_residence_2 === undefined || typeof voter.address_residence_2 === "string") &&
|
|
95
|
-
typeof voter.address_residence_city === "string" &&
|
|
95
|
+
(voter.address_residence_city === undefined || typeof voter.address_residence_city === "string") &&
|
|
96
96
|
typeof voter.address_residence_state_id === "string" &&
|
|
97
|
-
typeof voter.address_residence_zip === "string" &&
|
|
97
|
+
(voter.address_residence_zip === undefined || typeof voter.address_residence_zip === "string") &&
|
|
98
98
|
typeof voter.address_residence_latitude === "number" && !isNaN(voter.address_residence_latitude) &&
|
|
99
99
|
typeof voter.address_residence_longitude === "number" && !isNaN(voter.address_residence_longitude) &&
|
|
100
100
|
typeof voter.address_mail_1 === "string" &&
|
|
101
101
|
(voter.address_mail_2 === undefined || typeof voter.address_mail_2 === "string") &&
|
|
102
|
-
typeof voter.address_mail_city === "string" &&
|
|
102
|
+
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
103
103
|
typeof voter.address_mail_state_id === "string" &&
|
|
104
|
-
typeof voter.address_mail_zip === "string" &&
|
|
104
|
+
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
105
105
|
typeof voter.federal_house_district === "number" && !isNaN(voter.federal_house_district) &&
|
|
106
106
|
typeof voter.state_house_district === "number" && !isNaN(voter.state_house_district) &&
|
|
107
107
|
typeof voter.state_senate_district === "number" && !isNaN(voter.state_senate_district) &&
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export * from "./types/legistar/LegistarDocument"
|
|
|
56
56
|
export * from "./types/prism/Prism"
|
|
57
57
|
export * from "./types/prism/PrismMetric"
|
|
58
58
|
export * from "./types/prism/PrismVoter"
|
|
59
|
+
export * from "./types/prism/PrismSubPrism"
|
|
59
60
|
export * from "./types/prism/UserPrism"
|
|
60
61
|
export * from "./types/prism/Voter"
|
|
61
62
|
export * from "./types/prism/VoterTurnout"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class PrismSubPrism {
|
|
2
|
+
readonly prism_id : string
|
|
3
|
+
readonly sub_prism_id : string
|
|
4
|
+
readonly [x : string] : any
|
|
5
|
+
|
|
6
|
+
constructor(prism_sub_prism : PrismSubPrism) {
|
|
7
|
+
if (!PrismSubPrism.is(prism_sub_prism)) {
|
|
8
|
+
throw Error("Invalid input.")
|
|
9
|
+
}
|
|
10
|
+
this.prism_id = prism_sub_prism.prism_id
|
|
11
|
+
this.sub_prism_id = prism_sub_prism.sub_prism_id
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static is(prism_sub_prism : any) : prism_sub_prism is PrismSubPrism {
|
|
15
|
+
return (
|
|
16
|
+
prism_sub_prism !== undefined &&
|
|
17
|
+
typeof prism_sub_prism.prism_id === "string" &&
|
|
18
|
+
typeof prism_sub_prism.sub_prism_id === "string"
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -11,16 +11,16 @@ export class Voter {
|
|
|
11
11
|
readonly birth_date? : string
|
|
12
12
|
readonly address_residence_1 : string
|
|
13
13
|
readonly address_residence_2? : string
|
|
14
|
-
readonly address_residence_city : string
|
|
14
|
+
readonly address_residence_city? : string
|
|
15
15
|
readonly address_residence_state_id : string
|
|
16
|
-
readonly address_residence_zip : string
|
|
16
|
+
readonly address_residence_zip? : string
|
|
17
17
|
readonly address_residence_latitude : number
|
|
18
18
|
readonly address_residence_longitude : number
|
|
19
19
|
readonly address_mail_1 : string
|
|
20
20
|
readonly address_mail_2? : string
|
|
21
|
-
readonly address_mail_city : string
|
|
21
|
+
readonly address_mail_city? : string
|
|
22
22
|
readonly address_mail_state_id : string
|
|
23
|
-
readonly address_mail_zip : string
|
|
23
|
+
readonly address_mail_zip? : string
|
|
24
24
|
readonly federal_house_district : number
|
|
25
25
|
readonly state_house_district : number
|
|
26
26
|
readonly state_senate_district : number
|
|
@@ -96,16 +96,16 @@ export class Voter {
|
|
|
96
96
|
(voter.birth_date === undefined || typeof voter.birth_date === "string") &&
|
|
97
97
|
typeof voter.address_residence_1 === "string" &&
|
|
98
98
|
(voter.address_residence_2 === undefined || typeof voter.address_residence_2 === "string") &&
|
|
99
|
-
typeof voter.address_residence_city === "string" &&
|
|
99
|
+
(voter.address_residence_city === undefined || typeof voter.address_residence_city === "string") &&
|
|
100
100
|
typeof voter.address_residence_state_id === "string" &&
|
|
101
|
-
typeof voter.address_residence_zip === "string" &&
|
|
101
|
+
(voter.address_residence_zip === undefined || typeof voter.address_residence_zip === "string") &&
|
|
102
102
|
typeof voter.address_residence_latitude === "number" && !isNaN(voter.address_residence_latitude) &&
|
|
103
103
|
typeof voter.address_residence_longitude === "number" && !isNaN(voter.address_residence_longitude) &&
|
|
104
104
|
typeof voter.address_mail_1 === "string" &&
|
|
105
105
|
(voter.address_mail_2 === undefined || typeof voter.address_mail_2 === "string") &&
|
|
106
|
-
typeof voter.address_mail_city === "string" &&
|
|
106
|
+
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
107
107
|
typeof voter.address_mail_state_id === "string" &&
|
|
108
|
-
typeof voter.address_mail_zip === "string" &&
|
|
108
|
+
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
109
109
|
typeof voter.federal_house_district === "number" && !isNaN(voter.federal_house_district) &&
|
|
110
110
|
typeof voter.state_house_district === "number" && !isNaN(voter.state_house_district) &&
|
|
111
111
|
typeof voter.state_senate_district === "number" && !isNaN(voter.state_senate_district) &&
|