@utiln/strings
v1.0.2
Published
String helpers for the @utiln library
Readme
@utiln/strings
Small, dependency-light string helpers for TypeScript and JavaScript projects.
Install
npm install @utiln/stringsUsage
import { capitalize, truncate } from '@utiln/strings';
capitalize('hello world'); // "Hello world"
truncate('hello world', 8); // "hello wo..."API
| Export | Parameters | Returns | Description |
|--------|------------|---------|-------------|
| capitalize | text: string | string | Uppercases the first character |
| truncate | text: string, maxLength: number | string | Shortens text and appends ... when needed |
truncate throws if maxLength is not greater than 0.
Requirements
- Node.js 22+
- ESM (
"type": "module")
