@lacspace/preeti
Preeti ⇄ Unicode for Nepali: convert legacy Preeti-font ASCII text ("g]kfn") to Unicode Devanagari (नेपाल) and back. Handles short-i and reph reordering, half letters, ra-kaar (| and «), conjunct keys (क्ष ज्ञ त्र श्र …), Preeti numerals, and looksLikePreeti() to detect pasted legacy text. Pure JS, zero dependencies, React Native safe.
npm i @lacspace/preetiUsage
import { preetiToUnicode, unicodeToPreeti, looksLikePreeti } from "@lacspace/preeti";
preetiToUnicode("g]kfn ;/sf/sf k|wfgdGqLn] cfly{s ;'wf/sf] 3f]if0ff ug'{eof] .");
// "नेपाल सरकारका प्रधानमन्त्रीले आर्थिक सुधारको घोषणा गर्नुभयो ।"
unicodeToPreeti("निर्माण"); // "lgdf{0f" (paste into a document set in Preeti)
looksLikePreeti("g]kfn"); // true: offer to convert pasted legacy textExports 4
describelooksLikePreetipreetiToUnicodeunicodeToPreetiKeywords
More in Nepal Toolkit
Nepal's official public holidays by Bikram Sambat year, transcribed from the Ministry of Home Affairs notice in Nepal Rajpatra (BS 2083: Khanda 75, Sankhya 67, Bhag 5). BS + AD dates, English/Nepali names, kind (public holiday / observance with offices open), scope (national, regional with districts, community, women, education, disability), multi-day Dashain and Tihar ranges, lunar holidays the notice leaves undated kept as null. holidays(), holidaysOn(), isHoliday(), upcoming(), bsToAD()/adToBS(). Every date checked against the weekday printed in the notice. Pure JS, zero dependencies, React Native safe.
@lacspace/nepali-typingRomanised Nepali → Devanagari typing with per-word candidates, like a phonetic input method: "namaste" → नमस्ते, "mero desh" → मेरो देश, "kathmandu" → काठमाडौं, "netaharulai" → नेताहरूलाई. A frequency lexicon matched by a loose key that forgives romanisation variance (aa/a, sh/s, w/v/b, ch/chh, dropped schwas, nasals), typed case endings, English loanwords (facebook → फेसबुक), a phonetic engine with ITRANS capitals (T D N Sh → ट ड ण ष), buildLexicon() from your own Nepali text and learn() to remember picks. Pure JS, zero dependencies, React Native safe.
@lacspace/nepali-matchNepali and English matching for names and keywords in running text: normaliseNe() folds spelling variants (chandrabindu → anusvara, half nasal + consonant → anusvara, long/short vowels, nukta/ZWJ/ZWNJ, NFC, Devanagari digits); whole-word matching that lets Nepali postpositions follow a word (झापाको → Jhapa, जिल्लाहरूमा, काठमाडौंबाटै) but no other letters (पर्वतारोही ≠ Parbat); English whole words with short all-caps acronyms kept exact-case ("Come and see" ≠ SEE); near() for two terms within N characters in the same sentence (। . ? ! newline), dotted abbreviations kept together; offsets into the original text; splitSuffix(); and districtTerms() for all 77 districts with real-world spellings. Pure JS, zero dependencies, React Native safe.
@lacspace/nepali-dateBikram Sambat (BS) ↔ Gregorian (AD) date conversion — zero-dependency, isomorphic, with token formatting (Nepali digits & names), BS date arithmetic, parsing, calendar-month and fiscal-year helpers.
@lacspace/nepali-utilsEveryday Nepal helpers — NPR currency formatting, Devanagari numerals, amount-in-words, validators, provinces. Zero-dependency.
@lacspace/translitNepali ⇄ English name transliteration and cross-script fuzzy name matching — romanize Devanagari (schwa-deleted), generate spelling variants (Poudel/Paudel), strip honorifics, and match "Ram Chandra Poudel" to "रामचन्द्र पौडेल", with a per-token safety guard so different people who share a surname never collapse. Plus looksLikeName / isCommonWord so a search box doesn't transliterate ordinary words, and Devanagari-aware script-ratio analysis that ignores proper nouns and quotes. Zero-dependency, isomorphic, deterministic.