talha-asad / mongoose-url-slugs

Create URL compatiable slugs on mongoose models, ensuring uniqueness.
MIT License
40 stars 22 forks source link

Use slug package #17

Closed simison closed 7 years ago

simison commented 8 years ago

Hey! Thanks for this plugin.

I'm relying to slug package since it handles nicely a lot of edge cases.

var slug = require('slug'),
      URLSlugs = require('mongoose-url-slugs'),;

TagSchema.plugin(URLSlugs('label', {
  field: 'slug',
  generator: slug
}));

Perhaps you could simply use it internally as well? It's very similar to your custom solution already.

Thoughts / PR welcome?

talha-asad commented 8 years ago

That package has extensive options, however I am not sure if we should depend/internally use it. A URLSlugs.default.generator might be handy for people who choose to use it throughout their project.

talha-asad commented 8 years ago

On a second thought I think we should use that package. PR welcome.

simison commented 8 years ago

Yup. Actually I've been comparing a few of these libraries. While slug package is nice, it doesn't seem to be maintained anymore (https://github.com/dodo/node-slug/issues/32#issuecomment-213521254).

Looking at https://github.com/pid/speakingurl now.

talha-asad commented 7 years ago

Closing, you can always use it wherever you want through the option.