triangle-types 1.0.293 → 1.0.294

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.
@@ -4,6 +4,7 @@ import { County } from "./County.js";
4
4
  import { JurisdictionMetric } from "./JurisdictionMetric.js";
5
5
  import { Municipality } from "./Municipality.js";
6
6
  import { SchoolDistrict } from "./SchoolDistrict.js";
7
+ import { State } from "./State.js";
7
8
  export declare const jurisdiction_type_ids: readonly ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"];
8
9
  export type JurisdictionTypeID = typeof jurisdiction_type_ids[number];
9
10
  export declare function is_jurisdiction_type_id(jurisdiction_type_id: any): jurisdiction_type_id is JurisdictionTypeID;
@@ -19,6 +20,12 @@ export declare class JurisdictionAux extends Jurisdiction {
19
20
  constructor(jurisdiction: any);
20
21
  static is(jurisdiction: any): jurisdiction is JurisdictionAux;
21
22
  }
23
+ export declare class StateJurisdictionAux extends JurisdictionAux {
24
+ readonly jurisdiction_type_id: "state";
25
+ readonly state: State;
26
+ constructor(jurisdiction: any);
27
+ static is(jurisdiction: any): jurisdiction is StateJurisdictionAux;
28
+ }
22
29
  export declare class CountyJurisdictionAux extends JurisdictionAux {
23
30
  readonly jurisdiction_type_id: "county";
24
31
  readonly county: County;
@@ -4,6 +4,7 @@ import { County } from "./County.js";
4
4
  import { JurisdictionMetric } from "./JurisdictionMetric.js";
5
5
  import { Municipality } from "./Municipality.js";
6
6
  import { SchoolDistrict } from "./SchoolDistrict.js";
7
+ import { State } from "./State.js";
7
8
  export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"];
8
9
  export function is_jurisdiction_type_id(jurisdiction_type_id) {
9
10
  return jurisdiction_type_ids.includes(jurisdiction_type_id);
@@ -38,6 +39,23 @@ export class JurisdictionAux extends Jurisdiction {
38
39
  Array.isArray(jurisdiction.metrics) && jurisdiction.metrics.every(JurisdictionMetric.is));
39
40
  }
40
41
  }
42
+ export class StateJurisdictionAux extends JurisdictionAux {
43
+ jurisdiction_type_id;
44
+ state;
45
+ constructor(jurisdiction) {
46
+ if (!StateJurisdictionAux.is(jurisdiction)) {
47
+ throw Error("Invalid input.");
48
+ }
49
+ super(jurisdiction);
50
+ this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
51
+ this.state = jurisdiction.state;
52
+ }
53
+ static is(jurisdiction) {
54
+ return (jurisdiction !== undefined &&
55
+ jurisdiction.jurisdiction_type_id === "state" &&
56
+ State.is(jurisdiction.state));
57
+ }
58
+ }
41
59
  export class CountyJurisdictionAux extends JurisdictionAux {
42
60
  jurisdiction_type_id;
43
61
  county;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.293",
3
+ "version": "1.0.294",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ import { County } from "./County"
4
4
  import { JurisdictionMetric } from "./JurisdictionMetric"
5
5
  import { Municipality } from "./Municipality"
6
6
  import { SchoolDistrict } from "./SchoolDistrict"
7
+ import { State } from "./State"
7
8
 
8
9
  export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"] as const
9
10
 
@@ -56,6 +57,29 @@ export class JurisdictionAux extends Jurisdiction {
56
57
  }
57
58
  }
58
59
 
60
+ export class StateJurisdictionAux extends JurisdictionAux {
61
+ readonly jurisdiction_type_id : "state"
62
+ readonly state : State
63
+
64
+
65
+ constructor(jurisdiction : any) {
66
+ if (!StateJurisdictionAux.is(jurisdiction)) {
67
+ throw Error("Invalid input.")
68
+ }
69
+ super(jurisdiction)
70
+ this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
71
+ this.state = jurisdiction.state
72
+ }
73
+
74
+ static is(jurisdiction : any) : jurisdiction is StateJurisdictionAux {
75
+ return (
76
+ jurisdiction !== undefined &&
77
+ jurisdiction.jurisdiction_type_id === "state" &&
78
+ State.is(jurisdiction.state)
79
+ )
80
+ }
81
+ }
82
+
59
83
  export class CountyJurisdictionAux extends JurisdictionAux {
60
84
  readonly jurisdiction_type_id : "county"
61
85
  readonly county : County