slugify-string

1.0.0 • Public • Published

Slugify Sring

Slugify a string for use in a URL.

yarn add slugify-string

Usage

import slugify from 'slugify-string';

const title = 'How to Publish & Update a Package';
slugify(title);
// -> 'how-to-publish-and-update-a-package'

Custom whitelist

You can pass a custom whitelist to ensure certain characters are not transformed. In the following example .s are kept.

import slugify from 'slugify-string';

const title = 'React v16.3.0: New lifecycles and context API';
slugify(title, /[^a-z0-9.]/g);
// -> 'react-v16.3.0-new-lifecycles-and-context-api'

/slugify-string/

    Package Sidebar

    Install

    npm i slugify-string

    Weekly Downloads

    7

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    1.08 kB

    Total Files

    3

    Last publish

    Collaborators

    • simonlc