
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Sluggit is a lightweight TypeScript utility to convert strings into URL-friendly slugs. Removes emojis, accents, and special characters, supports custom separators, and preserves casing if needed.
This release refactors the codebase into small modules and introduces new options:
| Section | Description |
|---|---|
| Features | Key functionality of the package |
| Installation | How to install using NPM, Yarn, or PNPM |
| Quick Start | Minimal example to start using Sluggit |
| Usage | Full usage examples |
| API Reference | Function signature and parameters |
| Options | Available options and default values |
| Examples | Example inputs and expected outputs |
-, _, or any character)# npm
npm install sluggit
# yarn
yarn add sluggit
# pnpm
pnpm add sluggit
import { sluggit } from "sluggit";
const slug = sluggit("Hello World!"); // Output: hello-world
import { sluggit } from "sluggit";
// Basic usage
sluggit("Hello World!"); // hello-world
// Custom separator
sluggit("Hello World!", { separator: "_" }); // hello_world
// Preserve case
sluggit("Hello World!", { lowercase: false }); // Hello-World
// Remove emojis
sluggit("Hello 👋 World! 🌍"); // hello-world
// Handle accents
sluggit("Hôtel Crémieux"); // hotel-cremieux
function sluggit(input: string, options?: SluggitOptions): string;
input (string): The string to convert to a slugoptions (optional: SlugOptions): Configuration optionsThe SlugOptions interface provides the following configuration options:
interface SluggitOptions {
separator?: string; // Default: '-'
lowercase?: boolean; // Default: true
trim?: boolean; // Default: true
maxLength?: number; // Optional: max length of the slug
customReplacements?: Record<string, string>; // Optional mappings applied before slug generation
preserveNumbers?: boolean; // Default: true
removeTrailingDash?: boolean; // Default: false
}
separator: Character to use between words (default: '-')
lowercase: Convert the output to lowercase (default: true)
trim: Remove leading and trailing separators (default: true)
maxLength: When provided, the function attempts to keep whole tokens, truncating only at token boundaries when possible. If a numeric tail (e.g., a year) is present and the token before it is included in the truncated result, the numeric tail will be appended.
customReplacements: A map of strings to replace prior to slug generation. Useful for mapping © → c, ™ → tm, & → and, etc.
preserveNumbers: Whether numbers should be preserved (default: true). Set to false to remove all digits.
removeTrailingDash: When true, strip trailing separators from the final slug.
Here are some example inputs and their corresponding outputs:
| Input | Options | Output |
|---|---|---|
| "Hello World!" | default | "hello-world" |
| "Hello_World!" | { separator: '_' } | "hello_world" |
| "Hello World!" | { lowercase: false } | "Hello-World" |
| " Hello World! " | { trim: true } | "hello-world" |
| "Café & Résumé" | { customReplacements: { "&": "and" }} | "cafe-and-resume" |
| "Hello 👋 World! 🌍" | default | "hello-world" |
| "Product™ & Copyright©" | { customReplacements: { "™": "tm", "©": "c" }} | "product-tm-and-copyright-c" |
FAQs
A utility for generating slugs from text strings in TypeScript.
We found that sluggit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.