Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

setting Array as custom replaces numbers#113

Open
deyhle wants to merge 1 commit intopid:master from
deyhle:master
Open

setting Array as custom replaces numbers #113
deyhle wants to merge 1 commit intopid:master from
deyhle:master

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

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /