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

Add option to disable the platform locale #92

Merged
merged 3 commits into from Jan 1, 2022

Conversation

jhnns
Copy link
Contributor

@jhnns jhnns commented Dec 19, 2021

} else {
input = input.toLocaleLowerCase();
input = toLowerCase(input);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fixes a bug "by accident" where the locale hasn't been applied previously.

Object.defineProperty(String.prototype, 'toLocaleLowerCase', toLocaleLowerCase);
}
};
/* eslint-enable no-extend-native */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

readme.md Outdated
//=> 'loremİpsum'

camelCase('lorem-ipsum', {locale: false}); // ignore platform locale
//=> 'loremIpsum'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these additions are needed. It's enough to document it at the API docs for the option.

@sindresorhus
Copy link
Owner

You also need to update index.d.ts

@jhnns
Copy link
Contributor Author

jhnns commented Dec 20, 2021

I've updated the PR, ready to be reviewed again :)

@sindresorhus sindresorhus merged commit 65ccea6 into sindresorhus:main Jan 1, 2022
@jhnns jhnns deleted the disable-locale-option branch January 10, 2022 10:11
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.

None yet

2 participants