1.0.3 • Published 2 years ago

@garystorey/slugify v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 TypeRequiredDescription
stringYesThe string to strip whitespace
stringNoReplacement 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.