text-transform-plus
Text transformation utilities for Node.js
Installation
npm install text-transform-plus
Usage
const transform = require('text-transform-plus');
transform.toCamelCase('hello world');
transform.toSnakeCase('Hello World');
transform.toDashCase('Hello World');
transform.slugify('Hello World! 2024');
transform.truncate('Very long text here', 10);
transform.titleCase('hello world');
API
toCamelCase(str)
Convert string to camelCase
toSnakeCase(str)
Convert string to snake_case
toDashCase(str)
Convert string to dash-case
slugify(str, options)
Generate URL-friendly slug
truncate(str, length, suffix)
Truncate string with ellipsis
titleCase(str)
Capitalize first letter of each word
hash(str, algorithm)
Generate hash of string
sanitize(str)
Sanitize HTML special characters
removeAccents(str)
Remove accents from string
wordCount(str)
Count words in string
License
MIT