Licence
MIT
Version
1.0.0
Deps
0
Size
17 kB
Vulns
0
Weekly
0
tiny-string-utils
A lightweight, zero-dependency library for common string manipulations.
Installation
npm install tiny-string-utils
Usage
import { capitalize, slugify, camelCase, truncate } from 'tiny-string-utils';
capitalize('hello'); // 'Hello'
slugify('Hello World!'); // 'hello-world'
camelCase('foo-bar-baz'); // 'fooBarBaz'
truncate('Long text...', 8); // 'Long...'
Available Functions
capitalize(str)— Capitalize the first letterslugify(str)— Convert to URL-friendly slugtruncate(str, length, suffix?)— Truncate with suffixcamelCase(str)— Convert to camelCasekebabCase(str)— Convert to kebab-casesnakeCase(str)— Convert to snake_casereverse(str)— Reverse a stringcountWords(str)— Count wordsstripWhitespace(str)— Remove all whitespaceisPalindrome(str)— Check if palindromepadCenter(str, length, char?)— Center-pad a stringrepeat(str, count, separator?)— Repeat a string