From 0cccfaa0833ab45e1cb9133359e91aebd5bd2a88 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 30 Jul 2022 16:27:13 -0500 Subject: [PATCH] ability to standardize no-break space insanity --- package.json | 2 +- src/lib/standardize-pashto.test.ts | 1 + src/lib/standardize-pashto.ts | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index caf8ded..6e31d77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "3.6.6", + "version": "3.6.7", "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/lib/standardize-pashto.test.ts b/src/lib/standardize-pashto.test.ts index 193ecd9..0be9d81 100644 --- a/src/lib/standardize-pashto.test.ts +++ b/src/lib/standardize-pashto.test.ts @@ -23,6 +23,7 @@ const testPairs = [ ["راکوي؛", "راکوي؛"], ["راکوي!", "راکوي!"], ["راکوي.", "راکوي."], + ["ګڼه ګوڼه", "ګڼه ګوڼه"] ]; testPairs.forEach((pair) => { diff --git a/src/lib/standardize-pashto.ts b/src/lib/standardize-pashto.ts index 5952285..7af0b08 100644 --- a/src/lib/standardize-pashto.ts +++ b/src/lib/standardize-pashto.ts @@ -18,7 +18,9 @@ export function standardizePashto(input: string): string { // Replace ي in the middle of words with ی .replace(/ي(?=[\u0621-\u065f\u0670-\u06d3\u06d5])/g, "ی") // Replace آ two character version with combined آ character - .replace(/آ/g, "آ"); + .replace(/آ/g, "آ") + // Replace narrow no-break space with space + .replace(/\u202F/g, " "); } export function standardizePhonetics(input: string): string {