-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpetrovich.d.ts
More file actions
54 lines (43 loc) · 1.16 KB
/
petrovich.d.ts
File metadata and controls
54 lines (43 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
declare module "petrovich" {
export type PetrovichGender = "male" | "female" | "androgynous";
type PetrovichPersonFirst = {
gender: PetrovichGender;
first: string;
middle?: string;
last?: string;
};
type PetrovichPersonLast = {
gender: PetrovichGender;
first?: string;
middle?: string;
last: string;
};
type PetrovichPersonMiddle = {
gender: PetrovichGender;
first?: string;
middle: string;
last?: string;
};
export type PetrovichCase =
| "accusative"
| "dative"
| "genitive"
| "instrumental"
| "nominative"
| "prepositional";
export type PetrovichNamePart = "first" | "middle" | "last";
type PetrovichCallback = (text: string) => string;
type PetrovichCaseCallbackRecord = Record<PetrovichCase, PetrovichCallback>;
type PetrovichGenderCallback = Record<
PetrovichNamePart,
PetrovichCaseCallbackRecord
>;
export default function petrovich<T extends PetrovichPerson>(
person: T,
gcase: PetrovichCase,
): T;
export const androgynous: PetrovichGenderCallback;
export const female: PetrovichGenderCallback;
export const male: PetrovichGenderCallback;
export function detect_gender(middle: string): PetrovichGender;
}