Add option to disable the platform locale#92
Merged
Conversation
jhnns
commented
Dec 19, 2021
| input = preserveConsecutiveUppercase(input, toLowerCase); | ||
| } else { | ||
| input = input.toLocaleLowerCase(); | ||
| input = toLowerCase(input); |
Contributor
Author
There was a problem hiding this comment.
I think this fixes a bug "by accident" where the locale hasn't been applied previously.
jhnns
commented
Dec 19, 2021
| Object.defineProperty(String.prototype, 'toLocaleLowerCase', toLocaleLowerCase); | ||
| } | ||
| }; | ||
| /* eslint-enable no-extend-native */ |
Contributor
Author
There was a problem hiding this comment.
I tried to separate this mocking setup from the rest of the test. I'm not sure if you agree with this style of mocking String.prototype functions. Another solution would be to spin up a separate Node process with tr-TR as locale but I thought that would be a bigger change.
sindresorhus
requested changes
Dec 19, 2021
| //=> 'loremİpsum' | ||
|
|
||
| camelCase('lorem-ipsum', {locale: false}); // ignore platform locale | ||
| //=> 'loremIpsum' |
Owner
There was a problem hiding this comment.
I don't think these additions are needed. It's enough to document it at the API docs for the option.
Owner
|
You also need to update index.d.ts |
Contributor
Author
|
I've updated the PR, ready to be reviewed again :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in sindresorhus/camelcase-keys#81