@ianbalijawa16/str-man
v1.0.1
Published
A lightweight and efficient library for string transformations, validations, and formatting.
Downloads
127
Maintainers
Readme
@ianbalijawa16/str-man
A lightweight, dependency-free TypeScript library for string utilities.
Installation
npm install @ianbalijawa16/str-man
Features
- Case Conversions
- String Validations
- String Truncation and Padding
Usage
Case Conversions
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'
Validations
import { isValidEmail, isValidURL, isAlphanumeric } from '@ianbalijawa16/str-man';
console.log(isValidEmail('[email protected]')); // true
console.log(isValidURL('https://example.com')); // true
console.log(isAlphanumeric('Hello123')); // true
String Manipulation
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'
License
MIT