textConvert is a lightweight, dependency-free library for converting and analyzing text in many formats and conventions.
More features coming soon. Stay tuned!
- 📚 Table of Contents
- 🚀 Getting Started
- ✨ Features
- Quick Examples
- API Docs
- Advanced Examples
- Why Use textConvert?
- Contributing
- Changelog
- License
- Contributors ✨
npm install textconvert
// ES Module
import * as convert from 'textconvert';
// or CommonJS
const convert = require('textconvert');
- Case conversion: camelCase, PascalCase, snake_case, kebab-case
- Text analysis: word/letter/sentence/paragraph counting, reading time, etc.
- Language detection: English, French, Spanish, German, Italian, Portuguese, Dutch
- Number to words: Converts numbers < 100 million to English words
- Pure, dependency-free, and TypeScript-ready
import { camelCase, count, isEmail } from 'textconvert';
camelCase('hello world'); // 'helloWorld'
count('Hello, world!'); // 10
isEmail('user@example.com'); // true
See more usage examples in docs/RECIPES.md.
See the full API documentation for all functions, parameters, and return types.
// Detect language with options
import { detectLanguage, Language } from 'textconvert';
const result = detectLanguage('Hola mundo', 4, { maxCharsToAnalyze: 300 });
if (result.language === Language.Spanish) {
console.log('Spanish detected!');
}
// Get detailed text statistics
const stats = convert.getTextStats('Hello world. This is a test.');
console.log(stats.wordCount, stats.readingTimeFormatted);
// Convert numbers to words
console.log(convert.numbersToWords(987654));
// "nine hundred eighty-seven thousand six hundred and fifty-four"
- Lightweight & Dependency-Free: No external dependencies, fast and easy to use.
- Comprehensive Text Utilities: Covers case conversion, text analysis, language detection, and more.
- TypeScript Support: Fully typed for safe and productive development.
- Modern API: Designed for clarity, performance, and extensibility.
- Actively Maintained: Open to contributions and new features.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines and workflow.
If you are adding a new function, follow the step-by-step instructions in docs/ADDING_FUNCTION.md.
See CHANGELOG.md for release history and updates.
This project is licensed under the MIT License.
Nicolas Alkhoury 💬 🐛 💼 💻 🔣 🎨 📖 🤔 🚇 🚧 🧑🏫 📦 🔌 📆 🔬 👀 |
This project follows the all-contributors specification. Contributions of any kind welcome!