A lightweight, dependency-free TypeScript library for string utilities.
npm install @ianbalijawa16/str-man
- Case Conversions
- String Validations
- String Truncation and Padding
import { toCamelCase, toSnakeCase, toKebabCase, toPascalCase } from '@ianbalijawa16/str-man';
console.log(toCamelCase('hello world')); // 'helloWorld'
console.log(toSnakeCase('helloWorld')); // 'hello_world'
console.log(toKebabCase('HelloWorld')); // 'hello-world'
console.log(toPascalCase('hello world')); // 'HelloWorld'
import { isValidEmail, isValidURL, isAlphanumeric } from '@ianbalijawa16/str-man';
console.log(isValidEmail('test@example.com')); // true
console.log(isValidURL('https://example.com')); // true
console.log(isAlphanumeric('Hello123')); // true
import { truncate, padString } from '@ianbalijawa16/str-man';
console.log(truncate('Hello World', 5)); // 'Hello...'
console.log(padString('123', 5)); // '123 '
console.log(padString('123', 5, '0', 'left')); // '00123'
MIT