triangle-types 1.0.287 → 1.0.289
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.
|
@@ -7,9 +7,10 @@ export declare class Prism {
|
|
|
7
7
|
readonly name: string;
|
|
8
8
|
readonly jurisdiction_type_id: JurisdictionTypeID;
|
|
9
9
|
readonly jurisdiction_id: string;
|
|
10
|
-
readonly
|
|
10
|
+
readonly sub_jurisdiction_type_ids: JurisdictionTypeID[];
|
|
11
11
|
readonly party_type_ids?: VoterPartyTypeID[];
|
|
12
12
|
readonly target_ids: string[];
|
|
13
|
+
readonly layer_ids: string[];
|
|
13
14
|
readonly [x: string]: any;
|
|
14
15
|
constructor(prism: any);
|
|
15
16
|
static is(prism: any): prism is Prism;
|
|
@@ -7,9 +7,10 @@ export class Prism {
|
|
|
7
7
|
name;
|
|
8
8
|
jurisdiction_type_id;
|
|
9
9
|
jurisdiction_id;
|
|
10
|
-
|
|
10
|
+
sub_jurisdiction_type_ids;
|
|
11
11
|
party_type_ids;
|
|
12
12
|
target_ids;
|
|
13
|
+
layer_ids;
|
|
13
14
|
constructor(prism) {
|
|
14
15
|
if (!Prism.is(prism)) {
|
|
15
16
|
throw Error("Invalid input.");
|
|
@@ -19,9 +20,10 @@ export class Prism {
|
|
|
19
20
|
this.name = prism.name;
|
|
20
21
|
this.jurisdiction_type_id = prism.jurisdiction_type_id;
|
|
21
22
|
this.jurisdiction_id = prism.jurisdiction_id;
|
|
22
|
-
this.
|
|
23
|
+
this.sub_jurisdiction_type_ids = prism.sub_jurisdiction_type_ids;
|
|
23
24
|
this.party_type_ids = prism.party_type_ids;
|
|
24
25
|
this.target_ids = prism.target_ids;
|
|
26
|
+
this.layer_ids = prism.layer_ids;
|
|
25
27
|
}
|
|
26
28
|
static is(prism) {
|
|
27
29
|
return (prism !== undefined &&
|
|
@@ -30,8 +32,9 @@ export class Prism {
|
|
|
30
32
|
typeof prism.name === "string" &&
|
|
31
33
|
is_jurisdiction_type_id(prism.jurisdiction_type_id) &&
|
|
32
34
|
typeof prism.jurisdiction_id === "string" &&
|
|
33
|
-
|
|
35
|
+
Array.isArray(prism.sub_jurisdiction_type_ids) && prism.sub_jurisdiction_type_ids.every(is_jurisdiction_type_id) &&
|
|
34
36
|
(prism.party_type_ids === undefined || Array.isArray(prism.party_type_ids) && prism.party_type_ids.every(is_voter_party_type_id)) &&
|
|
35
|
-
Array.isArray(prism.target_ids) && prism.target_ids.every((target_id) => typeof target_id === "string")
|
|
37
|
+
Array.isArray(prism.target_ids) && prism.target_ids.every((target_id) => typeof target_id === "string") &&
|
|
38
|
+
Array.isArray(prism.layer_ids) && prism.layer_ids.every((layer_id) => typeof layer_id === "string"));
|
|
36
39
|
}
|
|
37
40
|
}
|
package/package.json
CHANGED
package/src/types/prism/Prism.ts
CHANGED
|
@@ -8,9 +8,10 @@ export class Prism {
|
|
|
8
8
|
readonly name : string
|
|
9
9
|
readonly jurisdiction_type_id : JurisdictionTypeID
|
|
10
10
|
readonly jurisdiction_id : string
|
|
11
|
-
readonly
|
|
11
|
+
readonly sub_jurisdiction_type_ids : JurisdictionTypeID[]
|
|
12
12
|
readonly party_type_ids? : VoterPartyTypeID[]
|
|
13
13
|
readonly target_ids : string[]
|
|
14
|
+
readonly layer_ids : string[]
|
|
14
15
|
readonly [x : string] : any
|
|
15
16
|
|
|
16
17
|
constructor(prism : any) {
|
|
@@ -22,9 +23,10 @@ export class Prism {
|
|
|
22
23
|
this.name = prism.name
|
|
23
24
|
this.jurisdiction_type_id = prism.jurisdiction_type_id
|
|
24
25
|
this.jurisdiction_id = prism.jurisdiction_id
|
|
25
|
-
this.
|
|
26
|
+
this.sub_jurisdiction_type_ids = prism.sub_jurisdiction_type_ids
|
|
26
27
|
this.party_type_ids = prism.party_type_ids
|
|
27
28
|
this.target_ids = prism.target_ids
|
|
29
|
+
this.layer_ids = prism.layer_ids
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
static is(prism : any) : prism is Prism {
|
|
@@ -35,9 +37,10 @@ export class Prism {
|
|
|
35
37
|
typeof prism.name === "string" &&
|
|
36
38
|
is_jurisdiction_type_id(prism.jurisdiction_type_id) &&
|
|
37
39
|
typeof prism.jurisdiction_id === "string" &&
|
|
38
|
-
|
|
40
|
+
Array.isArray(prism.sub_jurisdiction_type_ids) && prism.sub_jurisdiction_type_ids.every(is_jurisdiction_type_id) &&
|
|
39
41
|
(prism.party_type_ids === undefined || Array.isArray(prism.party_type_ids) && prism.party_type_ids.every(is_voter_party_type_id)) &&
|
|
40
|
-
Array.isArray(prism.target_ids) && prism.target_ids.every((target_id : any) => typeof target_id === "string")
|
|
42
|
+
Array.isArray(prism.target_ids) && prism.target_ids.every((target_id : any) => typeof target_id === "string") &&
|
|
43
|
+
Array.isArray(prism.layer_ids) && prism.layer_ids.every((layer_id : any) => typeof layer_id === "string")
|
|
41
44
|
)
|
|
42
45
|
}
|
|
43
46
|
}
|