@tpoisseau/slug

1.0.1 • Public • Published

js-slug

This package as no dependency and let you transform any string with special chars into a nice string with only Alpha, Digits and dash caracters. Typical use : Transform a title into a url segment.

Usage

If you use npm, you'll need node >12 because it's a ESM.

  • npm install @tpoisseau/slug
import slug from '@tpoisseau/slug';

If you wan't use it directly in browser

import slug from 'https://github.com/tpoisseau/js-slug/blob/1.0.0/index.mjs';

And then

slug('1 < 2') // 1-2
slug('Hey! How are you') // hey-how-are-you
slug('tôi tên là d͌ức tạ') // toi-ten-la-duc-ta
slug('learn adonis in 30 minutes') // learn-adonis-in-30-minutes

Readme

Keywords

Package Sidebar

Install

npm i @tpoisseau/slug

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

4.68 kB

Total Files

6

Last publish

Collaborators

  • tpoisseau