triangle-types 1.0.159 → 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.
@@ -10,8 +10,8 @@ export * from "./types/youtube/YoutubeVideo.js";
10
10
  export * from "./types/youtube/YoutubeVideoTag.js";
11
11
  export * from "./types/federal_census/FederalCensus.js";
12
12
  export * from "./types/federal_census/FederalCensusBlock.js";
13
- export * from "./types/federal_census/FederalCensusCity.js";
14
13
  export * from "./types/federal_census/FederalCensusCounty.js";
14
+ export * from "./types/federal_census/FederalCensusMunicipality.js";
15
15
  export * from "./types/federal_census/FederalCensusTract.js";
16
16
  export * from "./types/federal_elections/FederalElection.js";
17
17
  export * from "./types/federal_elections/FederalElectionCommittee.js";
package/dist/src/index.js CHANGED
@@ -10,8 +10,8 @@ export * from "./types/youtube/YoutubeVideo.js";
10
10
  export * from "./types/youtube/YoutubeVideoTag.js";
11
11
  export * from "./types/federal_census/FederalCensus.js";
12
12
  export * from "./types/federal_census/FederalCensusBlock.js";
13
- export * from "./types/federal_census/FederalCensusCity.js";
14
13
  export * from "./types/federal_census/FederalCensusCounty.js";
14
+ export * from "./types/federal_census/FederalCensusMunicipality.js";
15
15
  export * from "./types/federal_census/FederalCensusTract.js";
16
16
  export * from "./types/federal_elections/FederalElection.js";
17
17
  export * from "./types/federal_elections/FederalElectionCommittee.js";
@@ -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
  }
@@ -0,0 +1,11 @@
1
+ import { StateID } from "../regions/State.js";
2
+ export declare class FederalCensusMunicipality {
3
+ readonly federal_census_municipality_id: string;
4
+ readonly federal_census_id: number;
5
+ readonly municipality_id: string;
6
+ readonly state_id: StateID;
7
+ readonly municipality_type_id?: string;
8
+ readonly name: string;
9
+ constructor(federal_census_municipality: any);
10
+ static is(federal_census_municipality: any): federal_census_municipality is FederalCensusMunicipality;
11
+ }
@@ -0,0 +1,29 @@
1
+ import { is_state_id } from "../regions/State.js";
2
+ export class FederalCensusMunicipality {
3
+ federal_census_municipality_id;
4
+ federal_census_id;
5
+ municipality_id;
6
+ state_id;
7
+ municipality_type_id;
8
+ name;
9
+ constructor(federal_census_municipality) {
10
+ if (!FederalCensusMunicipality.is(federal_census_municipality)) {
11
+ throw Error("Invalid input.");
12
+ }
13
+ this.federal_census_municipality_id = federal_census_municipality.federal_census_municipality_id;
14
+ this.federal_census_id = federal_census_municipality.federal_census_id;
15
+ this.municipality_id = federal_census_municipality.municipality_id;
16
+ this.state_id = federal_census_municipality.state_id;
17
+ this.municipality_type_id = federal_census_municipality.municipality_type_id;
18
+ this.name = federal_census_municipality.name;
19
+ }
20
+ static is(federal_census_municipality) {
21
+ return (federal_census_municipality !== undefined &&
22
+ typeof federal_census_municipality.federal_census_municipality_id === "string" &&
23
+ typeof federal_census_municipality.federal_census_id === "number" &&
24
+ typeof federal_census_municipality.municipality_id === "string" &&
25
+ is_state_id(federal_census_municipality.state_id) &&
26
+ (federal_census_municipality.municipality_type_id === undefined || typeof federal_census_municipality.municipality_type_id === "string") &&
27
+ typeof federal_census_municipality.name === "string");
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.159",
3
+ "version": "1.0.161",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -13,8 +13,8 @@ export * from "./types/youtube/YoutubeVideoTag"
13
13
 
14
14
  export * from "./types/federal_census/FederalCensus"
15
15
  export * from "./types/federal_census/FederalCensusBlock"
16
- export * from "./types/federal_census/FederalCensusCity"
17
16
  export * from "./types/federal_census/FederalCensusCounty"
17
+ export * from "./types/federal_census/FederalCensusMunicipality"
18
18
  export * from "./types/federal_census/FederalCensusTract"
19
19
 
20
20
  export * from "./types/federal_elections/FederalElection"
@@ -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
 
@@ -0,0 +1,35 @@
1
+ import { is_state_id, StateID } from "../regions/State"
2
+
3
+ export class FederalCensusMunicipality {
4
+ readonly federal_census_municipality_id : string
5
+ readonly federal_census_id : number
6
+ readonly municipality_id : string
7
+ readonly state_id : StateID
8
+ readonly municipality_type_id? : string
9
+ readonly name : string
10
+
11
+ constructor(federal_census_municipality : any) {
12
+ if (!FederalCensusMunicipality.is(federal_census_municipality)) {
13
+ throw Error("Invalid input.")
14
+ }
15
+ this.federal_census_municipality_id = federal_census_municipality.federal_census_municipality_id
16
+ this.federal_census_id = federal_census_municipality.federal_census_id
17
+ this.municipality_id = federal_census_municipality.municipality_id
18
+ this.state_id = federal_census_municipality.state_id
19
+ this.municipality_type_id = federal_census_municipality.municipality_type_id
20
+ this.name = federal_census_municipality.name
21
+ }
22
+
23
+ static is(federal_census_municipality : any) : federal_census_municipality is FederalCensusMunicipality {
24
+ return (
25
+ federal_census_municipality !== undefined &&
26
+ typeof federal_census_municipality.federal_census_municipality_id === "string" &&
27
+ typeof federal_census_municipality.federal_census_id === "number" &&
28
+ typeof federal_census_municipality.municipality_id === "string" &&
29
+ is_state_id(federal_census_municipality.state_id) &&
30
+ (federal_census_municipality.municipality_type_id === undefined || typeof federal_census_municipality.municipality_type_id === "string") &&
31
+ typeof federal_census_municipality.name === "string"
32
+ )
33
+ }
34
+
35
+ }