more exposed

This commit is contained in:
lingdocs 2022-08-30 14:33:51 +04:00
parent 46c897735d
commit 07707195b1
5 changed files with 27 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "3.8.3", "version": "3.8.4",
"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

@ -0,0 +1,6 @@
import { isPashtoScript } from "./is-pashto";
test("isPashtoScript works", () => {
expect(isPashtoScript("کور")).toBe(true);
expect(isPashtoScript("kor")).toBe(false);
});

9
src/lib/is-pashto.ts Normal file
View File

@ -0,0 +1,9 @@
/**
* Determines if a string is written in Pashto script;
*/
const pashtoLetters = /[\u0600-\u06FF]/;
export function isPashtoScript(s: string): boolean {
return pashtoLetters.test(s);
}

View File

@ -26,13 +26,13 @@ import {
specifyEquativeLength, specifyEquativeLength,
} from "./blocks-utils"; } from "./blocks-utils";
const blank: T.PsString = { export const blank: T.PsString = {
p: "_____", p: "_____",
f: "_____", f: "_____",
}; };
type BlankoutOptions = { equative?: boolean, ba?: boolean, kidsSection?: boolean, verb?: boolean }; type BlankoutOptions = { equative?: boolean, ba?: boolean, kidsSection?: boolean, verb?: boolean };
const kidsBlank: T.PsString = { p: "___", f: "___" }; export const kidsBlank: T.PsString = { p: "___", f: "___" };
// function compilePs({ blocks, kids, verb: { head, rest }, VP }: CompilePsInput): T.SingleOrLengthOpts<T.PsString[]> { // function compilePs({ blocks, kids, verb: { head, rest }, VP }: CompilePsInput): T.SingleOrLengthOpts<T.PsString[]> {

View File

@ -39,6 +39,9 @@ import Block, { NPBlock, APBlock } from "./components/blocks/Block";
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal"; import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
import CompiledPTextDisplay from "./components/CompiledPTextDisplay"; import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay"; import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
import {
isPashtoScript,
} from "./lib/is-pashto";
import { import {
makePsString, makePsString,
removeFVarients, removeFVarients,
@ -120,9 +123,6 @@ import {
isSecondPerson, isSecondPerson,
isThirdPerson, isThirdPerson,
} from "./lib/misc-helpers"; } from "./lib/misc-helpers";
import {
flattenLengths,
} from "./lib/phrase-building/compile";
import { import {
simplifyPhonetics, simplifyPhonetics,
} from "./lib/simplify-phonetics"; } from "./lib/simplify-phonetics";
@ -153,6 +153,9 @@ import {
import { import {
compileEP, compileEP,
compileVP, compileVP,
flattenLengths,
blank,
kidsBlank,
} from "./lib/phrase-building/compile"; } from "./lib/phrase-building/compile";
import { import {
renderAPSelection, renderAPSelection,
@ -253,6 +256,9 @@ export {
vpsReducer, vpsReducer,
makeVPSelectionState, makeVPSelectionState,
blockUtils, blockUtils,
blank,
kidsBlank,
isPashtoScript,
// protobuf helpers // protobuf helpers
readDictionary, readDictionary,
writeDictionary, writeDictionary,