1.0.0 • Published 6 years ago

slugify-string v1.0.0

Weekly downloads
6
License
MIT
Repository
-
Last release
6 years ago

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'