Skip to content
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

As of 1.6.6, extending a character with "null" will break #177

Open
louh opened this issue Apr 22, 2023 · 1 comment
Open

As of 1.6.6, extending a character with "null" will break #177

louh opened this issue Apr 22, 2023 · 1 comment

Comments

@louh
Copy link

louh commented Apr 22, 2023

This worked in 1.6.5:

  slugify.extend({
    '|': null,
    '%': null,
    $: null
  })

This changes the behavior of slugifying a string like "100%" from "100percent" to simply "100".

However this will break in 1.6.6, with the error message "TypeError: Cannot read properties of null (reading 'replace')".

Updating the extend object to replace "null" with empty strings like so will behave as expected:

  slugify.extend({
    '|': '',
    '%': '',
    $: ''
  })

It looks like this change wasn't documented anywhere so I thought I'd drop this note here in case anyone else goes looking for a fix, like I did.

@simov
Copy link
Owner

simov commented Apr 23, 2023

Thanks, that's definitely helpful. Maybe we need some additional tests added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants