API Overview
@ppabari/strio exposes three entry points:
| Import | What it provides |
|---|---|
@ppabari/strio |
Secure generation + compatibility checks |
@ppabari/strio/str |
The general-purpose string-utility toolkit (this reference) |
@ppabari/strio/zod |
A zod schema for validating generation options |
Main export
- Secure Generation —
generateRandomString,generateId,generateExpiringToken,generatePassphrase, secrets, and more. - Compatibility —
checkCompatibility,assertCompatible.
String toolkit — @ppabari/strio/str
All functions are pure, individually importable, and tree-shakeable.
🎯 Manipulation
capitalize · capitalizeWords · reverse · truncate · truncateWords · trim · insert · mask
🔤 Case Conversion
camelize · pascalize · dasherize · underscore
✅ Validation
isEmpty · isBlank · isString · isAlpha · isNumeric · isAlphaNumeric · isUpperCase · isLowerCase
🔍 Searching
contains · containsAll · containsAny · count · between · betweenAll
🎨 Formatting
humanize · titleCase · slugify · ordinalize · pluralize
🛠️ Utilities
words · wordCount · join · template · random · randomAlpha · randomNumeric · randomAlphanumeric · similarity · transliterate
📏 Padding & Indentation
padLeft · padRight · padCenter · indent · dedent
🔐 Security
escapeHtml · unescapeHtml · escapeRegExp · stripTags · collapseWhitespace · stripPrefix · stripSuffix
✨ Ensuring
ensureLeft · ensureRight
Import styles
// Named imports (recommended — tree-shakeable)
import { slugify, camelize } from '@ppabari/strio/str';
// Namespace import
import * as str from '@ppabari/strio/str';
str.slugify('Hello World');
English-locale note: titleCase, pluralize, and ordinalize implement English rules. Internationalization is out of scope.