triangle-types 1.0.160 → 1.0.161
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.
|
@@ -9,6 +9,7 @@ export declare class FederalCensusBlock {
|
|
|
9
9
|
readonly block_id: string;
|
|
10
10
|
readonly state_id: StateID;
|
|
11
11
|
readonly name: string;
|
|
12
|
+
readonly polygon?: number[][];
|
|
12
13
|
constructor(federal_census_block: any);
|
|
13
14
|
static is(federal_census_block: any): federal_census_block is FederalCensusBlock;
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ export class FederalCensusBlock {
|
|
|
9
9
|
block_id;
|
|
10
10
|
state_id;
|
|
11
11
|
name;
|
|
12
|
+
polygon;
|
|
12
13
|
constructor(federal_census_block) {
|
|
13
14
|
if (!FederalCensusBlock.is(federal_census_block)) {
|
|
14
15
|
throw Error("Invalid input.");
|
|
@@ -22,6 +23,7 @@ export class FederalCensusBlock {
|
|
|
22
23
|
this.block_id = federal_census_block.block_id;
|
|
23
24
|
this.state_id = federal_census_block.state_id;
|
|
24
25
|
this.name = federal_census_block.name;
|
|
26
|
+
this.polygon = federal_census_block.polygon;
|
|
25
27
|
}
|
|
26
28
|
static is(federal_census_block) {
|
|
27
29
|
return (federal_census_block !== undefined &&
|
|
@@ -33,6 +35,7 @@ export class FederalCensusBlock {
|
|
|
33
35
|
typeof federal_census_block.tract_id === "string" &&
|
|
34
36
|
typeof federal_census_block.block_id === "string" &&
|
|
35
37
|
is_state_id(federal_census_block.state_id) &&
|
|
36
|
-
typeof federal_census_block.name === "string"
|
|
38
|
+
typeof federal_census_block.name === "string" &&
|
|
39
|
+
(federal_census_block.polygon === undefined || Array.isArray(federal_census_block.polygon) && federal_census_block.polygon.every(Array.isArray) && federal_census_block.polygon.every((vertex) => vertex.every((coordinate) => typeof coordinate === "number"))));
|
|
37
40
|
}
|
|
38
41
|
}
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export class FederalCensusBlock {
|
|
|
10
10
|
readonly block_id : string
|
|
11
11
|
readonly state_id : StateID
|
|
12
12
|
readonly name : string
|
|
13
|
+
readonly polygon? : number[][]
|
|
13
14
|
|
|
14
15
|
constructor(federal_census_block : any) {
|
|
15
16
|
if (!FederalCensusBlock.is(federal_census_block)) {
|
|
@@ -24,6 +25,7 @@ export class FederalCensusBlock {
|
|
|
24
25
|
this.block_id = federal_census_block.block_id
|
|
25
26
|
this.state_id = federal_census_block.state_id
|
|
26
27
|
this.name = federal_census_block.name
|
|
28
|
+
this.polygon = federal_census_block.polygon
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
static is(federal_census_block : any) : federal_census_block is FederalCensusBlock {
|
|
@@ -37,7 +39,8 @@ export class FederalCensusBlock {
|
|
|
37
39
|
typeof federal_census_block.tract_id === "string" &&
|
|
38
40
|
typeof federal_census_block.block_id === "string" &&
|
|
39
41
|
is_state_id(federal_census_block.state_id) &&
|
|
40
|
-
typeof federal_census_block.name === "string"
|
|
42
|
+
typeof federal_census_block.name === "string" &&
|
|
43
|
+
(federal_census_block.polygon === undefined || Array.isArray(federal_census_block.polygon) && federal_census_block.polygon.every(Array.isArray) && federal_census_block.polygon.every((vertex : any) => vertex.every((coordinate : any) => typeof coordinate === "number")))
|
|
41
44
|
)
|
|
42
45
|
}
|
|
43
46
|
|