Closed dhanielsales closed 2 years ago
remove
takes effect after all the characters in the string have been processed. It doesn't operate directly on the input.
You probably want to use extend
instead:
slugify.extend({ '%': '', '®': '' })
const foo = slugify(text, {
replacement: ' ',
lower: false,
})
Another option would be to use the slug
module instead of slugify
, as the current version (5.3.0) has the behavior you want (ignoring symbols like %
and ®
) by default.
import slug from 'slug'
const text = 'Natação foo % ® sdf'
const foo = slug(text, {
replacement: ' ',
lower: false,
})
console.log(foo) // Natacao foo sdf
I understand now thanks for the explanation :smile:
Hello guys,
I'm using the property
remove
on options and i haven't has the correct result. I will post the situation below.Even putting in
remove
a regex with%
it is still replaced by the wordpercent
. The same result for®
.If I'm doing something wrong, please let me know and I'll retract.
The version i'm using is
1.6.5