@n1hal/strx
v1.0.6
Published
Lightweight string helpers with no dependencies.
Downloads
5
Maintainers
Readme
@n1hal/strx
Repository for NPM package @n1hal/strx, utility package for string manipulations and string related tools. Small, dependency-free string helpers — clean, consistent, and zero bloat.
🚀 Features
- 💡 Lightweight – No dependencies, <1 KB minified.
- ✨ Modern ESM – Works seamlessly in Node and browsers.
- 📚 Typed – Includes full TypeScript definitions.
- ⚡ Handy – Covers common string formatting and casing tasks.
📦 Installation
npm i @n1hal/strxOr with pnpm:
pnpm add @n1hal/strxOr with Yarn:
yarn add @n1hal/strx🧠 Usage
import { capitalize, slugify, camelCase } from "@n1hal/strx";
capitalize("hello world"); // → "Hello world"
camelCase("hello world"); // → "helloWorld"
slugify("Hello World! Café"); // → "hello-world-cafe"Or use the default export:
import strx from "@n1hal/strx";
strx.titleCase("once upon a time"); // → "Once Upon A Time"
strx.truncate("A very long text that should be shortened", 20);
// → "A very long text..."⚙️ TypeScript Support
All functions are typed automatically:
import { titleCase } from "@n1hal/strx";
const title: string = titleCase("make it nice");🧪 Example Playground
You can quickly test all functions in Node REPL:
node
> import * as strx from "@n1hal/strx";
> strx.camelCase("Hello there friend");
'helloThereFriend'📖 License
🌟 Contribute
If you’d like to suggest new helpers or improve code coverage:
- Fork the repo
- Add your function to
index.js - Export and update
index.d.ts - Open a PR ✨
Keep your strings sharp with @n1hal/strx ✂️
