beygla
Version:
<h1 align="center"> Beygla </h1>
41 lines (40 loc) • 1.35 kB
TypeScript
declare type Case = "nf" | "þf" | "þgf" | "ef" | "nom" | "acc" | "dat" | "gen";
declare let predicate: ((name: string) => boolean) | null;
export declare function setPredicate(pred: typeof predicate): void;
/**
* Applies a case to a source name provided in the nominative
* case (nefnifall).
*
* @example
* ```tsx
* applyCase("ef", "Jóhann");
* //=> "Jóhannesar"
*
* applyCase("þgf", "Helga Fríða Smáradóttir");
* //=> "Helgu Fríðu Smáradóttur"
* ```
*
* The name provided must be an Icelandic name in the nominative case
* (nefnifall). Otherwise, an unexpected output is likely.
*
* The supported cases are:
*
* - Nominative `nom` (nefnifall `nf` in Icelandic)
* - Accusative `acc` (þolfall `þf` in Icelandic)
* - Dative `dat` (þágufall `þgf` in Icelandic)
* - Genitive `gen` (eignarfall `ef` in Icelandic)
*
* Note that superfluous whitespace is not retained:
*
* @example
* ```tsx
* applyCase("þf", " \n Hildigerður Oddný\tPatreksdóttir \n\n");
* //=> "Hildigerði Oddnýju Patreksdóttur"
* ```
*
* @param name - An Icelandic name in the nominative case (nefnifall)
* @param caseStr - The case to apply to the name to, e.g. `þf`
*/
export declare function applyCase(caseStr: Case, name: string): string;
export declare function getDeclensionForName(name: string): string | null;
export {};