testing for plural inflections set

This commit is contained in:
lingdocs 2021-09-14 20:54:27 -04:00
parent 69be75317b
commit e6e35cc0ec
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "1.0.2", "version": "1.0.3",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -62,7 +62,7 @@ const InflectionTable = ({ inf, textOptions }: {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{(!isPluralInfs ? ["Plain", "1st", "2nd"] : ["Plural", "2nd"]).map((title, i) => ( {(!isPluralInfs ? ["Plain", "1st", "2nd"] : ["Plural", "2nd Inf."]).map((title, i) => (
<tr key={title}> <tr key={title}>
<th scope="row">{title}</th> <th scope="row">{title}</th>
{"masc" in inf && <TableCell item={inf.masc[i]} textOptions={textOptions} />} {"masc" in inf && <TableCell item={inf.masc[i]} textOptions={textOptions} />}

View File

@ -255,10 +255,19 @@ export function isVerbBlock(x: unknown): x is T.VerbBlock {
); );
} }
export function isPluralInflectionSet(x: any): x is T.PluralInflectionSet {
return (
Array.isArray(x)
&& (x.length === 2)
&& "p" in x[0][0]
);
}
export function isImperativeBlock(x: unknown): x is T.ImperativeBlock { export function isImperativeBlock(x: unknown): x is T.ImperativeBlock {
return ( return (
Array.isArray(x) && Array.isArray(x) &&
(x.length === 2) && (x.length === 2) &&
!("p" in x[0][0]) &&
"p" in x[0][0][0] "p" in x[0][0][0]
); );
} }