improve endsWith
This commit is contained in:
parent
acbe165d3f
commit
7b5242d165
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"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",
|
||||
|
|
|
@ -1152,6 +1152,8 @@ test("endsWith", () => {
|
|||
.toBe(false);
|
||||
expect(endsWith({ p: ["د", "ت"] }, { p: "چت", f: "chat" }))
|
||||
.toBe(true);
|
||||
expect(endsWith([{ p: "ای", f: "aay" }, { p: ["د", "ت"] }], { p: "چت", f: "chat" }))
|
||||
.toBe(true);
|
||||
expect(endsWith({ p: ["ډ", "د"] }, { p: "چت", f: "chat" }))
|
||||
.toBe(false);
|
||||
// ability to curry
|
||||
|
|
|
@ -957,6 +957,8 @@ export function isPluralInflections(inf: T.PluralInflections | T.Inflections): i
|
|||
return inf.fem.length === 2;
|
||||
}
|
||||
|
||||
|
||||
// TODO: make this usable with things like endsWith([{ f: ["t", "b"] } | { ps: "ای", f: "aay" }])
|
||||
/**
|
||||
* determines if ps ends with a given ending, or one of an array of given endings
|
||||
* (can be accent sensitive or not)
|
||||
|
@ -966,16 +968,16 @@ export function isPluralInflections(inf: T.PluralInflections | T.Inflections): i
|
|||
*
|
||||
*/
|
||||
export function endsWith(
|
||||
ending: T.PsString | T.PsString[] | { p: string | string[] } | { f: string | string[] },
|
||||
ending: (T.PsString | { p: string | string[] } | { f: string | string[] }) | (T.PsString | { p: string | string[] } | { f: string | string[] })[],
|
||||
ps?: boolean,
|
||||
): (ps: T.PsString) => boolean;
|
||||
export function endsWith(
|
||||
ending: T.PsString | T.PsString[] | { p: string | string[] } | { f: string | string[] },
|
||||
ending: (T.PsString | { p: string | string[] } | { f: string | string[] }) | (T.PsString | { p: string | string[] } | { f: string | string[] })[],
|
||||
ps: T.PsString,
|
||||
matchAccent?: boolean,
|
||||
): boolean;
|
||||
export function endsWith(
|
||||
ending: T.PsString | T.PsString[] | { p: string | string[] } | { f: string | string[] },
|
||||
ending: (T.PsString | { p: string | string[] } | { f: string | string[] }) | (T.PsString | { p: string | string[] } | { f: string | string[] })[],
|
||||
ps: T.PsString | undefined | boolean,
|
||||
matchAccent?: boolean | undefined,
|
||||
): boolean | ((ps: T.PsString) => boolean) {
|
||||
|
|
Loading…
Reference in New Issue