# ember-slugify

> Library to slugify your strings within Ember.

Latest version **6.0.0** (published 2023-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-slugify
pnpm add ember-slugify
yarn add ember-slugify
bun add ember-slugify
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2023-12-02 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Dazzling Fugu |
| Maintainers | mr.chocolatine, ndekeister-us, bluecut, njoyard, greatwizard |
| Keywords | accent, accents, diacritics, ember, emberjs, ember-addon, simple-pinyin, slug, slugify, string |

## Links

- npm: https://www.npmjs.com/package/ember-slugify
- Repository: https://github.com/DazzlingFugu/ember-slugify
- Issues: https://github.com/DazzlingFugu/ember-slugify/issues
- npm.io page: https://npm.io/package/ember-slugify

## Dependencies (4)

- [slugify](https://npm.io/package/slugify.md) ^1.6.6
- [emoji.json](https://npm.io/package/emoji.json.md) ^15.1.0
- [simple-pinyin](https://npm.io/package/simple-pinyin.md) ^4.0.0
- [@embroider/addon-shim](https://npm.io/package/@embroider/addon-shim.md) ^1.8.4

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 6.0.0 (latest) — 2023-12-02
- 5.0.0 — 2023-05-25
- 4.0.0 — 2023-02-24
- 3.0.1 — 2022-08-11
- 3.0.0 — 2022-01-19
- 2.0.0 — 2021-11-04
- 1.3.0 — 2020-08-21
- 1.2.0 — 2020-06-15
- 1.1.1 — 2019-07-05

## README

# ember-slugify

[![CI](https://github.com/DazzlingFugu/ember-slugify/actions/workflows/ci.yml/badge.svg)](https://github.com/DazzlingFugu/ember-slugify/actions/workflows/ci.yml) [![Ember Observer Score](https://emberobserver.com/badges/ember-slugify.svg)](https://emberobserver.com/addons/ember-slugify) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Library to slugify your strings within Ember.

This library uses:

- [slugify](https://github.com/simov/slugify)
- [simple-pinyin](https://github.com/xuqingkuang/simple-pinyin)
- [emoji.json](https://github.com/amio/emoji.json)

## Compatibility

- Ember.js v4.8 or above
- Embroider or ember-auto-import v2

## Installation

```
ember install ember-slugify
```

## Usage

### In a `js` file

```js
import slugify, { removeDiacritics } from 'ember-slugify'

let slug = slugify('Le Théâtre')
// le-theatre

slug = slugify('I ♥ New York')
// i-love-new-york

slug = slugify("Vive l'♥", { locale: 'fr' })
// vive-lamour

slug = slugify('bonjour monsieur', { replacement: '#' })
// bonjour#monsieur

slug = slugify('你好你怎么样 monsieur', { pinyin: true })
// ni-hao-ni-zen-me-yang-monsieur

slug = slugify('🇫🇷❤️🥖➕🍷', { emoji: true })
// flag-france-red-heart-baguette-bread-plus-wine-glass

let noDiacritics = removeDiacritics('Le Théâtre')
// Le Theatre
```

### In a template

```hbs
{{slugify 'Le Théâtre'}}

{{slugify '你好你怎么样 monsieur' (hash pinyin=true)}}

{{slugify '🇫🇷❤️🥖➕🍷' (hash emoji=true)}}

{{remove-diacritics 'Le Théâtre'}}
```

The separator option is not available on `slugify` helper.

### Options

| name        | description                                                    | default value |
| ----------- | -------------------------------------------------------------- | ------------- |
| replacement | replace spaces with replacement character                      | `'-'`         |
| lower       | convert to lower case                                          | `true`        |
| locale      | language code of the locale to use                             | `undefined`   |
| trim        | trim leading and trailing replacement chars                    | `true`        |
| pinyin      | replace chinese by latin character following the pinyin method | `false`       |
| emoji       | replace unicode emoji by it's description                      | `false`       |

## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.

## Contributors

<!-- readme: contributors,ember-tomster/- -start -->
<table>
<tr>
    <td align="center">
        <a href="https://github.com/MrChocolatine">
            <img src="https://avatars.githubusercontent.com/u/47531779?v=4" width="100;" alt="MrChocolatine"/>
            <br />
            <sub><b>MrChocolatine</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/GreatWizard">
            <img src="https://avatars.githubusercontent.com/u/1322081?v=4" width="100;" alt="GreatWizard"/>
            <br />
            <sub><b>GreatWizard</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/saintsebastian">
            <img src="https://avatars.githubusercontent.com/u/8288415?v=4" width="100;" alt="saintsebastian"/>
            <br />
            <sub><b>saintsebastian</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/BlueCutOfficial">
            <img src="https://avatars.githubusercontent.com/u/22059380?v=4" width="100;" alt="BlueCutOfficial"/>
            <br />
            <sub><b>BlueCutOfficial</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/mathieupoteriepeopledoc">
            <img src="https://avatars.githubusercontent.com/u/40787872?v=4" width="100;" alt="mathieupoteriepeopledoc"/>
            <br />
            <sub><b>mathieupoteriepeopledoc</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/romgere">
            <img src="https://avatars.githubusercontent.com/u/13900970?v=4" width="100;" alt="romgere"/>
            <br />
            <sub><b>romgere</b></sub>
        </a>
    </td></tr>
<tr>
    <td align="center">
        <a href="https://github.com/ndekeister-us">
            <img src="https://avatars.githubusercontent.com/u/56396753?v=4" width="100;" alt="ndekeister-us"/>
            <br />
            <sub><b>ndekeister-us</b></sub>
        </a>
    </td>
    <td align="center">
        <a href="https://github.com/xcambar">
            <img src="https://avatars.githubusercontent.com/u/657654?v=4" width="100;" alt="xcambar"/>
            <br />
            <sub><b>xcambar</b></sub>
        </a>
    </td></tr>
</table>
<!-- readme: contributors,ember-tomster/- -end -->

## License

This project is licensed under the [MIT License](LICENSE.md).

---
_Source: https://npm.io/package/ember-slugify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
