Package detail

@garystorey/slugify

garystorey343MIT1.0.3

A small utility to remove/replace whitepace from a string

rollup, vitest, typescript, slugify

readme

slugify

A small dependency-free utility to remove whitespace from a string.

Version Size License

Leywords

Installation

You can install either with npm or yarn:

npm install @garystorey/slugify

yarn add @garystorey/slugify

Parameters

Parameter Type Required Description
string Yes The string to strip whitespace
string No Replacement character


Usage

slugify has one required string parameter.

import slugify from '@garystorey/slugify';
const slug = slugify('My Title');
console.log(slug);
// "mytitle"

Optionally, a replacement character can be provided as a second argument:

import slugify from '@garystorey/slugify';
const slug = slugify('My Title','_');
console.log(slug);
// "my_title"

slugify is written in TypeScript.