1.1.0 • Published 6 months ago
romanize-nepali v1.1.0
romanize-nepali
A Node.js package for romanizing Nepali (Devanagari) text to Latin script.
Installation
npm install romanize-nepali
Usage
import { romanizeNepali, isNepaliText } from 'romanize-nepali';
// Basic usage
console.log(romanizeNepali('नेपाल')); // Output: nepal
console.log(romanizeNepali('नमस्ते')); // Output: namaste
// Mixed text
console.log(romanizeNepali('Hello नेपाल')); // Output: Hello nepal
Features
- Converts Nepali (Devanagari) text to romanized form
- Handles special consonant conjuncts
- Processes matras (vowel diacritics) correctly
- Preserves non-Nepali text
- Zero dependencies
- Lightweight and easy to use
API
romanizeNepali(text)
Converts Nepali text to its romanized form.
- Parameters:
text
(string): The Nepali text to be romanized
- Returns:
- (string): The romanized version of the input text
- Behavior:
- Returns empty string if input is null or undefined
- Returns input as-is if no Nepali characters are found
- Handles consonants, vowels, matras, and Nepali numbers
License
MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.