1 | <p align="center">
|
2 | <h1>🌐 Slugy</h1>
|
3 | <span>Easily slugify url & titles from any ordinary string.</span>
|
4 | </p>
|
5 |
|
6 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-192A34.svg?style=flat-square)](https://github.com/prettier/prettier)
|
7 | [![npm version][npm-version-src]][npm-version-href]
|
8 | [![Dependencies][david-dm-src]][david-dm-href]
|
9 | [![npm downloads][npm-downloads-src]][npm-downloads-href]
|
10 | [![package phobia][package-phobia-src]][package-phobia-href]
|
11 | [![bundle phobia][bundle-phobia-src]][bundle-phobia-href]
|
12 |
|
13 | ## Installation
|
14 |
|
15 | Using yarn:
|
16 |
|
17 | ```bash
|
18 | yarn add slugy
|
19 | ```
|
20 |
|
21 | Using npm:
|
22 |
|
23 | ```bash
|
24 | npm i slugy
|
25 | ```
|
26 |
|
27 | ## Usage
|
28 |
|
29 | ```ts
|
30 | import { slugy } from 'slugy';
|
31 |
|
32 | const slug = await slugy('Hello World'); // hello-world
|
33 |
|
34 | // With options:
|
35 | const slug = await slugy('Hello World', { separator: '_', lower: false }); // Hello_World
|
36 |
|
37 | // Turning off Unidecode
|
38 | const slug = slugy('\u1515\u14c7\u14c7', { unidecode: false }); // ᔕᓇᓇ
|
39 | ```
|
40 |
|
41 |
|
42 |
|
43 | [standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/green
|
44 | [standard-js-href]: https://standardjs.com
|
45 | [npm-version-src]: https://flat.badgen.net/npm/v/slugy/latest
|
46 | [npm-version-href]: https://npmjs.com/package/slugy
|
47 | [npm-downloads-src]: https://flat.badgen.net/npm/dt/slugy
|
48 | [npm-downloads-href]: https://npmjs.com/package/slugy
|
49 | [package-phobia-src]: https://flat.badgen.net/packagephobia/install/slugy
|
50 | [package-phobia-href]: https://packagephobia.now.sh/result?p=slugy
|
51 | [bundle-phobia-src]: https://flat.badgen.net/bundlephobia/minzip/slugy
|
52 | [bundle-phobia-href]: https://bundlephobia.com/result?p=slugy
|
53 | [david-dm-src]: https://david-dm.org/gomah/slugy/status.svg?style=flat-square
|
54 | [david-dm-href]: https://david-dm.org/gomah/slugy
|