-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change the replacement behaviour for dash ("-") #141
Comments
Can you provide sample code or at least sample input and desired output? That is not the behavior I see. Dashes, at least in the middle of words and with a letter on either side, are preserved as far as I can tell. > slugify('foo-bar')
'foo-bar'
> |
In our case we have a string like "1952--", so the dashes are at the end.
|
By default, To suppress the trimming behavior, set > slugify('1952--')
'1952'
> slugify('1952--', { trim: false})
'1952-'
> That gets you part of the way there, but not quite. |
Not sure about > slug.charmap['-'] = '-'
'-'
> slug('1952--')
'1952--' I'm not sure what the equivalent in |
If you look at slugify.js line 37 you'll see that each character gets checked against the If you pass I'm running into this issue right now where I want |
Those spaces get turned into dashes again. I don't understand the problem you're describing. This seems to work as expected: console.log(slugify('josh-', {trim: false})) // 'josh-' |
I'll double check and make sure this is still happening, hopefully the |
Here's another scenario to consider, if you pass either It'd be nice to have an option not to automatically replace instances of the replacement option with a space so we can choose to get |
Dashes ("-") are simply removed by slugify. We need to have them replaced by something else.
Is the replacement of dashes configurable?
The text was updated successfully, but these errors were encountered: