slugger-unique

Create slugs using slugger while ensuring they are unique.

Usage no npm install needed!

<script type="module">
  import sluggerUnique from 'https://cdn.skypack.dev/slugger-unique';
</script>

README

slugger-unique

npm travis

Create slugs using slugger while ensuring they are unique.

Install

npm install slugger-unique

Usage

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 first.

License

ISC