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.
- 💡 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.
npm i @n1hal/strxOr with pnpm:
pnpm add @n1hal/strxOr with Yarn:
yarn add @n1hal/strximport { 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..."import { titleCase } from "@n1hal/strx";
const title: string = titleCase("make it nice");node
> import * as strx from "@n1hal/strx";
> strx.camelCase("Hello there friend");
'helloThereFriend'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 ✂️