Text Processing
removeTashkeel
Removes Arabic diacritical marks (tashkeel) from text. Location:src/utils/search.ts:1
Arabic text containing diacritical marks
Text with all tashkeel removed and wasl sign normalized
- Replaces wasl sign (ٱ) with regular alef (ا)
- Removes harakat and diacritics (Unicode ranges U+064B-065F, U+0670, U+06D6-06E8)
- Preserves base Arabic characters
normalizeArabicText
Normalizes Arabic text by removing diacritics and standardizing characters for searching. Location:src/utils/search.ts:17
Arabic text to normalize
Normalized text suitable for comparison and search
- Removes all tashkeel (via
removeTashkeel) - Normalizes alef variants (آ، أ، إ → ا)
- Normalizes hamza variants (ؤ، ئ → ء)
- Normalizes ya/alif maqsura (ى → ي)
- Removes tatweel (ـ)
- Normalizes hamza above/below (ٔ، ٕ → ء)
- Converts taa marbuta to haa (ة → ه)
Formatting
formatTime
Converts seconds toMM:SS time format.
Location: src/utils/format-time.ts:1
Time in seconds (can include decimals)
Formatted time string in
M:SS or MM:SS format- Floors seconds to whole numbers
- Pads seconds with leading zero if needed
- No hour support (assumes tracks under 60 minutes)
Styling
cn
Utility for merging Tailwind CSS classes with proper precedence. Location:src/utils/cn.ts:4
Class names, objects, or arrays to merge
Merged class string with Tailwind conflicts resolved
- Uses
clsxfor conditional classes - Uses
tailwind-mergefor proper Tailwind class precedence - Handles strings, objects, arrays, and conditional classes
Data Processing
generateFavId
Generates a unique identifier for a reciter-moshaf combination. Location:src/utils/generate-fav-id.ts:3
Reciter object containing
id and moshaf.idUnique ID in format
{reciterId}-{moshafId}- Storing favorites in local storage
- Tracking favorite counts
- Identifying unique reciter-moshaf pairs
Sharing
useShareReciter
Hook for sharing reciter profiles via Web Share API or clipboard. Location:src/utils/share.ts:5
Returns:
Async function to share a reciter
- Uses native Web Share API when available
- Falls back to clipboard copy
- Generates shareable URL with reciter ID and moshaf ID
- Internationalized messages
- User feedback via alerts
Type Exports
All utilities are exported from the main index file: Location:src/utils/index.ts:1-11
Some utilities listed in the index are not documented here. Additional utilities can be found in the source code at
src/utils/.