Skip to content

Conversation

@deyhle
Copy link

@deyhle deyhle commented Nov 23, 2017

I found a bug when using the option to set an Array of allowed characters by giving an Array to the custom option: it replaces numbers in the string with the allowed characters.

Example:

getSlug('0.1,', { custom: ['.', ','] })
// expected: '0.1,' (no replacement)
// actual: '0011' (. is replaced with 0, , is replaced with 1)

The reason is that the check if the custom property is an object also returns true if it is an Array. Because of that a replacement map is set for the Array indizes and 0, 1, … are replaced with the custom allowed characters.

This pull requests adds a test and a fix for that by additionally checking if the object is not an Array.
It would be great if you could publish an update to npm with that fix

@deyhle
Copy link
Author

deyhle commented May 23, 2018

Could you please merge this pull request and publish to npm?

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

Successfully merging this pull request may close these issues.

1 participant