triangle-types 1.0.36 → 1.0.37
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
declare const fragment_type_ids: readonly ["LINE", "CHAR"];
|
|
2
|
+
export type FragmentTypeID = typeof fragment_type_ids[number];
|
|
3
|
+
export declare function is_fragment_type_id(fragment_type_id: any): fragment_type_id is FragmentTypeID;
|
|
1
4
|
export declare class Fragment {
|
|
2
5
|
readonly fragment_id: string;
|
|
6
|
+
readonly fragment_type_id: FragmentTypeID;
|
|
3
7
|
readonly max_size: number;
|
|
4
8
|
readonly min_index: number;
|
|
5
9
|
readonly max_index: number;
|
|
@@ -35,3 +39,4 @@ export declare class TwitterTweetFragment extends Fragment {
|
|
|
35
39
|
constructor(fragment: TwitterTweetFragment);
|
|
36
40
|
static is(fragment: any): fragment is TwitterTweetFragment;
|
|
37
41
|
}
|
|
42
|
+
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
const fragment_type_ids = ["LINE", "CHAR"];
|
|
2
|
+
export function is_fragment_type_id(fragment_type_id) {
|
|
3
|
+
return fragment_type_ids.includes(fragment_type_id);
|
|
4
|
+
}
|
|
1
5
|
export class Fragment {
|
|
2
6
|
fragment_id;
|
|
7
|
+
fragment_type_id;
|
|
3
8
|
max_size;
|
|
4
9
|
min_index;
|
|
5
10
|
max_index;
|
|
@@ -10,6 +15,7 @@ export class Fragment {
|
|
|
10
15
|
throw Error("Invalid input.");
|
|
11
16
|
}
|
|
12
17
|
this.fragment_id = fragment.fragment_id;
|
|
18
|
+
this.fragment_type_id = fragment.fragment_type_id;
|
|
13
19
|
this.max_size = fragment.max_size;
|
|
14
20
|
this.min_index = fragment.min_index;
|
|
15
21
|
this.max_index = fragment.max_index;
|
|
@@ -19,6 +25,7 @@ export class Fragment {
|
|
|
19
25
|
static is(fragment) {
|
|
20
26
|
return (fragment !== undefined &&
|
|
21
27
|
typeof fragment.fragment_id === "string" &&
|
|
28
|
+
is_fragment_type_id(fragment.fragment_type_id) &&
|
|
22
29
|
typeof fragment.max_size === "number" &&
|
|
23
30
|
typeof fragment.min_index === "number" &&
|
|
24
31
|
typeof fragment.max_index === "number" &&
|
package/package.json
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
const fragment_type_ids = ["LINE", "CHAR"] as const
|
|
2
|
+
|
|
3
|
+
export type FragmentTypeID = typeof fragment_type_ids[number]
|
|
4
|
+
|
|
5
|
+
export function is_fragment_type_id(fragment_type_id : any) : fragment_type_id is FragmentTypeID {
|
|
6
|
+
return fragment_type_ids.includes(fragment_type_id)
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
export class Fragment {
|
|
2
10
|
readonly fragment_id : string
|
|
11
|
+
readonly fragment_type_id : FragmentTypeID
|
|
3
12
|
readonly max_size : number
|
|
4
13
|
readonly min_index : number
|
|
5
14
|
readonly max_index : number
|
|
@@ -12,6 +21,7 @@ export class Fragment {
|
|
|
12
21
|
throw Error("Invalid input.")
|
|
13
22
|
}
|
|
14
23
|
this.fragment_id = fragment.fragment_id
|
|
24
|
+
this.fragment_type_id = fragment.fragment_type_id
|
|
15
25
|
this.max_size = fragment.max_size
|
|
16
26
|
this.min_index = fragment.min_index
|
|
17
27
|
this.max_index = fragment.max_index
|
|
@@ -23,6 +33,7 @@ export class Fragment {
|
|
|
23
33
|
return (
|
|
24
34
|
fragment !== undefined &&
|
|
25
35
|
typeof fragment.fragment_id === "string" &&
|
|
36
|
+
is_fragment_type_id(fragment.fragment_type_id) &&
|
|
26
37
|
typeof fragment.max_size === "number" &&
|
|
27
38
|
typeof fragment.min_index === "number" &&
|
|
28
39
|
typeof fragment.max_index === "number" &&
|