triangle-types 1.0.107 → 1.0.109
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/County.d.ts +8 -0
- package/dist/src/types/County.js +25 -0
- package/dist/src/types/SchoolDistrict.d.ts +10 -0
- package/dist/src/types/SchoolDistrict.js +26 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/County.ts +33 -0
- package/src/types/SchoolDistrict.ts +31 -0
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
|
|
2
|
+
import { is_state_id } from "./State.js";
|
|
3
|
+
// export type CountyTypeID = typeof county_type_ids[number]
|
|
4
|
+
// export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
|
|
5
|
+
// return county_type_ids.includes(county_type_id)
|
|
6
|
+
// }
|
|
7
|
+
export class County {
|
|
8
|
+
county_id;
|
|
9
|
+
state_id;
|
|
10
|
+
name;
|
|
11
|
+
constructor(county) {
|
|
12
|
+
if (!County.is(county)) {
|
|
13
|
+
throw Error("Invalid input.");
|
|
14
|
+
}
|
|
15
|
+
this.county_id = county.county_id;
|
|
16
|
+
this.state_id = county.state_id;
|
|
17
|
+
this.name = county.name;
|
|
18
|
+
}
|
|
19
|
+
static is(county) {
|
|
20
|
+
return (county !== undefined &&
|
|
21
|
+
typeof county.county_id === "string" &&
|
|
22
|
+
is_state_id(county.state_id) &&
|
|
23
|
+
typeof county.name === "string");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StateID } from "./State.js";
|
|
2
|
+
export declare class SchoolDistrict {
|
|
3
|
+
readonly school_district_id: string;
|
|
4
|
+
readonly state_id: StateID;
|
|
5
|
+
readonly county_id: string;
|
|
6
|
+
readonly state_school_district_id: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
constructor(school_district: any);
|
|
9
|
+
static is(school_district: any): school_district is SchoolDistrict;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { is_state_id } from "./State.js";
|
|
2
|
+
export class SchoolDistrict {
|
|
3
|
+
school_district_id;
|
|
4
|
+
state_id;
|
|
5
|
+
county_id;
|
|
6
|
+
state_school_district_id;
|
|
7
|
+
name;
|
|
8
|
+
constructor(school_district) {
|
|
9
|
+
if (!SchoolDistrict.is(school_district)) {
|
|
10
|
+
throw Error("Invalid input.");
|
|
11
|
+
}
|
|
12
|
+
this.school_district_id = school_district.school_district_id;
|
|
13
|
+
this.state_id = school_district.state_id;
|
|
14
|
+
this.county_id = school_district.county_id;
|
|
15
|
+
this.state_school_district_id = school_district.state_school_district_id;
|
|
16
|
+
this.name = school_district.name;
|
|
17
|
+
}
|
|
18
|
+
static is(school_district) {
|
|
19
|
+
return (school_district !== undefined &&
|
|
20
|
+
typeof school_district.school_district_id === "string" &&
|
|
21
|
+
is_state_id(school_district.state_id) &&
|
|
22
|
+
typeof school_district.county_id === "string" &&
|
|
23
|
+
typeof school_district.state_school_district_id === "string" &&
|
|
24
|
+
typeof school_district.name === "string");
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
|
|
2
|
+
|
|
3
|
+
import { is_state_id, StateID } from "./State"
|
|
4
|
+
|
|
5
|
+
// export type CountyTypeID = typeof county_type_ids[number]
|
|
6
|
+
|
|
7
|
+
// export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
|
|
8
|
+
// return county_type_ids.includes(county_type_id)
|
|
9
|
+
// }
|
|
10
|
+
|
|
11
|
+
export class County {
|
|
12
|
+
readonly county_id : string
|
|
13
|
+
readonly state_id : StateID
|
|
14
|
+
readonly name : string
|
|
15
|
+
|
|
16
|
+
constructor(county : any) {
|
|
17
|
+
if (!County.is(county)) {
|
|
18
|
+
throw Error("Invalid input.")
|
|
19
|
+
}
|
|
20
|
+
this.county_id = county.county_id
|
|
21
|
+
this.state_id = county.state_id
|
|
22
|
+
this.name = county.name
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static is(county : any) : county is County {
|
|
26
|
+
return (
|
|
27
|
+
county !== undefined &&
|
|
28
|
+
typeof county.county_id === "string" &&
|
|
29
|
+
is_state_id(county.state_id) &&
|
|
30
|
+
typeof county.name === "string"
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "./State"
|
|
2
|
+
|
|
3
|
+
export class SchoolDistrict {
|
|
4
|
+
readonly school_district_id : string
|
|
5
|
+
readonly state_id : StateID
|
|
6
|
+
readonly county_id : string
|
|
7
|
+
readonly state_school_district_id : string
|
|
8
|
+
readonly name : string
|
|
9
|
+
|
|
10
|
+
constructor(school_district : any) {
|
|
11
|
+
if (!SchoolDistrict.is(school_district)) {
|
|
12
|
+
throw Error("Invalid input.")
|
|
13
|
+
}
|
|
14
|
+
this.school_district_id = school_district.school_district_id
|
|
15
|
+
this.state_id = school_district.state_id
|
|
16
|
+
this.county_id = school_district.county_id
|
|
17
|
+
this.state_school_district_id = school_district.state_school_district_id
|
|
18
|
+
this.name = school_district.name
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static is(school_district : any) : school_district is SchoolDistrict {
|
|
22
|
+
return (
|
|
23
|
+
school_district !== undefined &&
|
|
24
|
+
typeof school_district.school_district_id === "string" &&
|
|
25
|
+
is_state_id(school_district.state_id) &&
|
|
26
|
+
typeof school_district.county_id === "string" &&
|
|
27
|
+
typeof school_district.state_school_district_id === "string" &&
|
|
28
|
+
typeof school_district.name === "string"
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|