improve flattenLengths
This commit is contained in:
parent
af5b24eb18
commit
dc0cd48015
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "2.6.7",
|
"version": "2.6.8",
|
||||||
"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",
|
||||||
|
|
|
@ -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) {
|
if ("long" in r) {
|
||||||
return Object.values(r).flat();
|
return Object.values(r).flat();
|
||||||
}
|
}
|
||||||
return r;
|
if (Array.isArray(r)) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
return [r];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {
|
export function putKidsInKidsSection(segments: Segment[], kids: Segment[]): Segment[] {
|
||||||
|
|
Loading…
Reference in New Issue