@garystorey/slugify
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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.

Package Sidebar

Install

npm i @garystorey/slugify

Weekly Downloads

14

Version

1.0.3

License

MIT

Unpacked Size

5.53 kB

Total Files

8

Last publish

Collaborators

  • garystorey