A comprehensive string manipulation utility library built with TypeScript for modern JavaScript applications.
- 🚀 Modern ESM support with full TypeScript types
- 📦 Multiple entry points for tree-shaking optimization
- 🔧 Comprehensive utilities for string formatting and validation
- 💪 Fully typed with excellent IDE support
- 🎯 Zero dependencies - lightweight and fast
npm install @developaul/string-utils
# or
pnpm add @developaul/string-utils
# or
yarn add @developaul/string-utils
import { kebabCase, capitalize, isEmail } from '@developaul/string-utils';
// Format strings
const slug = kebabCase('Hello World'); // 'hello-world'
const title = capitalize('hello world'); // 'Hello world'
// Validate strings
const valid = isEmail('test@example.com'); // true
import { formatters, validators } from '@developaul/string-utils';
// Use formatters
const slug = formatters.slugify('Hello World!'); // 'hello-world'
const camel = formatters.camelCase('hello-world'); // 'helloWorld'
// Use validators
const isValidEmail = validators.isEmail('test@example.com'); // true
const hasLength = validators.hasMinLength('hello', 3); // true
// Import only formatters
import { kebabCase, titleCase } from '@developaul/string-utils/formatters';
// Import only validators
import { isEmail, isUrl } from '@developaul/string-utils/validators';
Convert a string to kebab-case.
kebabCase('Hello World') // 'hello-world'
kebabCase('camelCase') // 'camel-case'
Convert a string to camelCase.
camelCase('hello-world') // 'helloWorld'
camelCase('snake_case') // 'snakeCase'
Capitalize the first letter of a string.
capitalize('hello world') // 'Hello world'
Convert a string to Title Case.
titleCase('hello world') // 'Hello World'
titleCase('the quick brown fox') // 'The Quick Brown Fox'
Create a URL-friendly slug from a string.
slugify('Hello World!') // 'hello-world'
slugify('The Quick Brown Fox') // 'the-quick-brown-fox'
Truncate a string to a specified length.
truncate('Hello World', 5) // 'Hello...'
truncate('Hello World', 5, '!') // 'Hello!'
Check if a string is a valid email address.
isEmail('test@example.com') // true
isEmail('invalid-email') // false
Check if a string is a valid URL.
isUrl('https://example.com') // true
isUrl('not-a-url') // false
Check if a string contains only alphanumeric characters.
isAlphanumeric('abc123') // true
isAlphanumeric('abc-123') // false
Check if a string is empty or contains only whitespace.
isEmpty('') // true
isEmpty(' ') // true
isEmpty('hello') // false
Check if a string has a minimum length.
hasMinLength('hello', 3) // true
hasMinLength('hi', 3) // false
Check if a string matches a pattern.
matchesPattern('123', /^\d+$/) // true
matchesPattern('abc', /^\d+$/) // false
This package follows Semantic Versioning.
Current version: 0.1.0-alpha.0
This package is part of the @breaking
monorepo for learning package publishing workflows.
MIT License - see LICENSE file for details.