You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the way slugify checkes for undefined, when we replace char with empty string, things might not work as expected.
for example, I want to replace ☢ with radioactive, and colon with empty space, I'll have to do it in extend and also remove. and before I dive in deep into src code, I was using slugify.extend({ '&': '', '.': '-', '%': '', ':': '' })
and expect that it will replace the char that I specified will be gone, however, & was not replaced but removed by .replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '')
and because of this, the colon didn't work out for me (colon should be replaced by empty string).
Am I missing something? if not, could we change from: return result + (locale[ch] || charMap[ch] || ch)
to return result + (locale[ch] !== undefined ? locale[ch] : charMap[ch] !== undefined ? charMap[ch] : ch)
The text was updated successfully, but these errors were encountered:
Not necessarily a great solution and probably something you already realize, but just in case: You can work around this in your own code by explicitly sending a remove option that omits the ::
Because the way slugify checkes for undefined, when we replace char with empty string, things might not work as expected.
for example, I want to replace ☢ with radioactive, and colon with empty space, I'll have to do it in
extend
and alsoremove
. and before I dive in deep into src code, I was usingslugify.extend({ '&': '', '.': '-', '%': '', ':': '' })
and expect that it will replace the char that I specified will be gone, however,
&
was not replaced but removed by.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '')
and because of this, the colon didn't work out for me (colon should be replaced by empty string).
Am I missing something? if not, could we change from:
return result + (locale[ch] || charMap[ch] || ch)
to
return result + (locale[ch] !== undefined ? locale[ch] : charMap[ch] !== undefined ? charMap[ch] : ch)
The text was updated successfully, but these errors were encountered: