We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97d1abd commit e9b006cCopy full SHA for e9b006c
lib/simple-slugify.js
@@ -2,13 +2,13 @@
2
3
const crypto = require('crypto');
4
5
-const regex = /[&/\\#,+()$~%.'":*?!<>{} ]/g;
+const regex = /[&/\\#,+()$~%.'":*?!<>{}]/g;
6
7
module.exports = function (schema) {
8
schema.pre(['save'], async function (next) {
9
const { source } = schema.tree.slug;
10
11
- let slug = this[source].toString().toLowerCase().trim().replace(regex, '-');
+ let slug = this[source].toString().toLowerCase().trim().replaceAll(' ', '-').replace(regex, '');
12
13
try {
14
slug = (await this.model(this.constructor.modelName).exists({ slug }))
0 commit comments