From 5805ee423bda5e0ac8532d884d708d12a29d1265 Mon Sep 17 00:00:00 2001 From: adueck Date: Wed, 9 Nov 2022 13:49:54 +0500 Subject: [PATCH] type and function for getting the entry from FullEntry form --- package-lock.json | 4 ++-- package.json | 2 +- src/components/package.json | 2 +- src/lib/library.ts | 2 ++ src/lib/package.json | 2 +- src/lib/src/misc-helpers.ts | 4 ++++ src/types.ts | 3 +++ 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9471a9a..6bf226a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "5.1.9", + "version": "5.1.10", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index b82859f..5e5b485 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "5.1.9", + "version": "5.1.10", "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", diff --git a/src/components/package.json b/src/components/package.json index 9dac658..50a9471 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "5.1.9", + "version": "5.1.10", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/lib/library.ts b/src/lib/library.ts index b655f4c..f9c3da8 100644 --- a/src/lib/library.ts +++ b/src/lib/library.ts @@ -105,6 +105,7 @@ import { blank, kidsBlank, ensureNonComboVerbInfo, + entryOfFull, } from "./src/misc-helpers"; import { simplifyPhonetics, @@ -237,6 +238,7 @@ export { kidsBlank, isPashtoScript, getInflectionPattern, + entryOfFull, // protobuf helpers readDictionary, writeDictionary, diff --git a/src/lib/package.json b/src/lib/package.json index 41d5180..6677c0b 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "5.1.9", + "version": "5.1.10", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/misc-helpers.ts b/src/lib/src/misc-helpers.ts index 14dabf8..abf07f9 100644 --- a/src/lib/src/misc-helpers.ts +++ b/src/lib/src/misc-helpers.ts @@ -14,6 +14,10 @@ export const blank: T.PsString = { }; export const kidsBlank: T.PsString = { p: "___", f: "___" }; +export function entryOfFull(e: T.FullEntry): T.DictionaryEntry { + return "entry" in e ? e.entry : e; +} + // just for type safety export function noPersInfs(s: T.OptionalPersonInflections>): T.LengthOptions; export function noPersInfs(s: T.FullForm): T.SingleOrLengthOpts; diff --git a/src/types.ts b/src/types.ts index 947dfbf..493c03e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -500,6 +500,9 @@ export type VerbEntry = { complement?: DictionaryEntry, }; +/** A dictionary entry that will include the complement / verb entry structure if it's a verb */ +export type FullEntry = VerbEntry | DictionaryEntry; + export enum InflectionPattern { None = 0, Basic = 1,