Keep the persian-tools published bundle small, tree-shakable, and side-effect-free. Use whenever a change might add or grow the bundle — a new dataset, a new module, a new dependency, or a refactor that moves code between files. Also use when "JS bundle" or "Type definitions" size-limit checks fail in CI. Covers the…
Validate, parse, or generate Iranian identity and financial identifiers — National ID (کد ملی), Legal ID (شناسه ملی حقوقی), Sheba/IBAN, debit card number, bill ID/payment ID, mobile and landline phone numbers, license plates. Use whenever the user asks to "verify a card number", "validate national id", "check sheba"…
Author a new utility module under src/modules/ of the persian-tools library. Use when the user asks to "add a new module", "create a utility", "implement a feature", "add a function to persian-tools", or wants to extend the public API with a new Persian/Iranian text or validation helper. Encodes the exact directory…
Write Vitest test files for persian-tools modules that match the repo's existing patterns. Use when adding a test alongside a new module, writing regression tests for a bug fix, or extending coverage. Encodes the exact assertion shape used for thrown errors ("PersianTools: - "), the parameterized-case style, the…
Domain knowledge for processing Persian (Farsi) text correctly inside the persian-tools codebase. Use whenever the work touches Persian or Arabic strings, half-space (ZWNJ), RTL direction, digit conversion, character normalization, or "looks Persian but isn't" bugs. Triggers on requests mentioning Farsi, Persian text…
Cut a release of @persian-tools/persian-tools — version bump, changelog generation, bundle verification, and publish to npm. Use when the user asks to "release", "publish", "ship a new version", "tag a release", "bump version", or "release beta". Encodes the exact standard-version-driven flow, Conventional Commits…
Instructions for persian-tools/persian-tools, covering api design instructions for persian-tools, function design principles, naming conventions, function signatures and parameter design.
Instructions for persian-tools/persian-tools, covering persian language processing instructions, understanding persian text, character sets, key differences: persian vs arabic and persian digits.
Instructions for persian-tools/persian-tools, covering testing instructions for persian-tools, testing philosophy, test structure with vitest, basic test template and persian language testing.
Instructions for persian-tools/persian-tools, covering typescript development instructions, typescript best practices for persian-tools, type safety, function signatures and type definitions.
Instructions for persian-tools/persian-tools, covering ai agent instructions for persian-tools, general agent guidelines, code understanding, development workflow and code quality standards.
Decode percent-encoded Persian (or any non-ASCII) URLs into a human-readable form, optionally replacing spaces with a separator. Use when displaying URLs in UI, logging, or generating slugs from copy-pasted percent-encoded URLs. Triggers on requests mentioning urlFix, URLfix, decode Persian URL, percent-encoded farsi…
Append the Persian ordinal suffix to a Persian word so "سه" becomes "سوم", "دو" becomes "دوم", etc. Use when generating ordinal phrases ("نفر سوم", "صفحه پنجم") from cardinal Persian number words. Triggers on mentions of addOrdinalSuffix, Persian ordinal, "سوم/پنجم/سیزدهم", ordinal Farsi suffix.
Parse and validate Iranian utility bills (water, electricity, gas, landline, mobile, municipal, tax, traffic fines) given a bill ID + payment ID pair, or a combined barcode. Use when implementing bill-pay flows, validating user-entered bill numbers, or extracting bill type and amount. Triggers on mentions of Bill…
Add or strip thousands-separator commas in numeric strings, with support for Persian-digit input. Use when formatting money amounts, prices, or quantities for display, or parsing back a comma-formatted string into a number. Triggers on requests mentioning addCommas, removeCommas, thousands separator, formatNumber, or…
Convert digits between Persian (۰-۹), Arabic-Indic (٠-٩), and English (0-9) numeral systems. Use when normalizing user input that may contain mixed numeral systems, formatting numbers for Persian/Arabic display, or pattern-matching numeric content. Triggers on requests mentioning Persian digits, Farsi numbers…
Extract Iranian card numbers from free-form text — supports Persian/Arabic digits, separators (dashes, underscores, spaces), fuzzy matching for masked/typo'd cards, optional validation and bank lookup, and large-text optimization. Use when scraping chat logs, OCR output, payment confirmation emails, or any…
Look up the capital city of an Iranian province by its Persian name (e.g. "خراسان رضوی" → "مشهد"). Use when displaying capital info next to a province name, or building dropdowns/forms keyed by province. Triggers on mentions of findCapitalByProvince, capital of province, مرکز استان, پایتخت استان.
Resolve a GPS coordinate (longitude, latitude) to the Iranian province it falls inside, using GeoJSON polygon containment. Returns both Persian and English province names. Use when geo-tagging user locations, routing deliveries by province, or annotating uploaded points-of-interest. Triggers on mentions of…
Resolve the issuing Iranian bank's Persian name from a card number by looking up its 6-digit BIN prefix. Use when displaying "Card from بانک سامان" next to a captured card number. Triggers on mentions of getBankNameFromCardNumber, bank from card, BIN lookup, نام بانک از شماره کارت.
Look up the registering city and province for an Iranian National ID by its leading 3-digit prefix. Use when displaying provenance information alongside a National ID in admin tools or KYC flows. Triggers on requests about getPlaceByIranNationalId, city from national id, province from کد ملی, محل صدور.
Insert Zero-Width Non-Joiner (ZWNJ, U+200C, نیمفاصله) characters between Persian words and their prefixes/suffixes/compound parts according to Persian typography rules. Use when prettifying user-entered Persian text, preparing copy for typesetting, or fixing کلمات بد جدا شده. Triggers on requests mentioning…
Detect whether a string is in the Arabic script or contains Arabic characters. Use when separating Arabic from Persian/Farsi input, validating that text is Arabic before applying Arabic-specific NLP, or routing multilingual input. Triggers on mentions of isArabic, hasArabic, Arabic detection, Arabic script validation…
Detect whether a string is Persian (Farsi) or contains Persian characters, and normalize Arabic-script characters to their Persian equivalents. Use when validating Persian input, deciding whether to apply Persian-specific formatting, or auto-converting Arabic characters typed on an Arabic keyboard. Triggers on…