ladjs / mongoose-slug-plugin

Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
https://lad.js.org
MIT License
22 stars 9 forks source link

fix: isAsync is deprecated #7

Closed paullbn closed 4 years ago

paullbn commented 5 years ago

Hello,

This PR solves the following mongoose deprecation warning:

DeprecationWarning: Mongoose: the `isAsync` option for custom validators is deprecated.
Make your async validators return a promise instead: https://mongoosejs.com/docs/validation.html#async-custom-validators

Paul

codecov[bot] commented 5 years ago

Codecov Report

Merging #7 into master will decrease coverage by 1.25%. The diff coverage is 80%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7      +/-   ##
=======================================
- Coverage   81.25%   80%   -1.25%     
=======================================
  Files           1     1              
  Lines          48    50       +2     
=======================================
+ Hits           39    40       +1     
- Misses          9    10       +1
Impacted Files Coverage Δ
index.js 80% <80%> (-1.25%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2536dc2...6a32a09. Read the comment docs.

paullbn commented 5 years ago

Ok, i thought there was a reason i didn't know that the validator was asynchronous with isAsync set to true, so i've just put it in a promise.

I'll update the PR as soon as i can

luluhoc commented 4 years ago

Will you update it?

niftylettuce commented 4 years ago

PR welcome!

niftylettuce commented 4 years ago

v2.0.2 has been released to npm with this fixed

npm install mongoose-slug-plugin@latest

or with yarn:

yarn add mongoose-slug-plugin@latest