1.0.3 • Published 3 years ago
@garystorey/slugify v1.0.3
slugify
A small dependency-free utility to remove whitespace from a string.
Installation
You can install either with npm or yarn:
npm install @garystorey/slugify
yarn add @garystorey/slugifyParameters
| 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.