https://github.com/flet/slugger-unique
:baseball: Create slugs using slugger while ensuring they are unique.
https://github.com/flet/slugger-unique
Last synced: 10 months ago
JSON representation
:baseball: Create slugs using slugger while ensuring they are unique.
- Host: GitHub
- URL: https://github.com/flet/slugger-unique
- Owner: Flet
- License: isc
- Created: 2015-09-10T23:07:03.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T22:56:53.000Z (over 6 years ago)
- Last Synced: 2025-02-24T04:17:58.482Z (over 1 year ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# slugger-unique
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[npm-image]: https://img.shields.io/npm/v/slugger-unique.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/slugger-unique
[travis-image]: https://img.shields.io/travis/flet/slugger-unique.svg?style=flat-square
[travis-url]: https://travis-ci.org/Flet/slugger-unique
Create slugs using [slugger](https://github.com/HenrikJoreteg/slugger) while ensuring they are unique.
## Install
```
npm install slugger-unique
```
## Usage
```js
var SluggerUnique = require('slugger-unique')
var slugger = new SluggerUnique()
slugger.slug('foo')
// returns 'foo'
slugger.slug('foo')
// returns 'foo-1'
slugger.slug('bar')
// returns 'bar'
slugger.slug('foo')
// returns 'foo-2'
slugger.reset()
slugger.slug('foo')
// returns 'foo'
```
## Contributing
Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
## License
[ISC](LICENSE)