@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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    13
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    13
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i @garystorey/slugify

Weekly Downloads

13

Version

1.0.3

License

MIT

Unpacked Size

5.53 kB

Total Files

8

Last publish

Collaborators

  • garystorey