JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q90610F
  • License MIT

Lightweight string helpers with no dependencies.

Package Exports

  • @n1hal/strx
  • @n1hal/strx/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@n1hal/strx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.

npm version license npm bundle size


๐Ÿš€ 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/strx

Or with pnpm:

pnpm add @n1hal/strx

Or 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

MIT ยฉ 2025 Nihal K


๐ŸŒŸ Contribute

If youโ€™d like to suggest new helpers or improve code coverage:

  1. Fork the repo
  2. Add your function to index.js
  3. Export and update index.d.ts
  4. Open a PR โœจ

Keep your strings sharp with @n1hal/strx โœ‚๏ธ