improve flattenLengths

This commit is contained in:
lingdocs 2022-05-30 15:23:02 -05:00
parent af5b24eb18
commit dc0cd48015
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -82,11 +82,14 @@ export function combineSegments(loe: (Segment | " " | "" | T.PsString)[], spaces
);
}
export function flattenLengths(r: T.SingleOrLengthOpts<T.PsString[]>): T.PsString[] {
export function flattenLengths(r: T.SingleOrLengthOpts<T.PsString[] | T.PsString>): T.PsString[] {
if ("long" in r) {
return Object.values(r).flat();
}
if (Array.isArray(r)) {
return r;
}
return [r];
}
export function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {