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

Can exclude option support function parameter? #80

Open
lessfish opened this issue Nov 21, 2021 · 4 comments
Open

Can exclude option support function parameter? #80

lessfish opened this issue Nov 21, 2021 · 4 comments

Comments

@lessfish
Copy link

In my case

const obj = { '_name': true }
console.log(camelcaseKeys(obj)); // { name: true }

but I don't want to lose leading _ in _name, how can I achieve it?

Thanks

@sindresorhus
Copy link
Owner

It could, yes, but you can also solve this with a regex: {exclude: [/^_/]}.

@lessfish
Copy link
Author

I just want to keep the leading _, for example, when the string is _name_obj, I just want to get _nameObj after conversion

with {exclude: [/^_/]}, it will stay _name_obj, is there some way to achieve it? Or it is not a normal demand?

@sindresorhus
Copy link
Owner

I think we could add a preserveLeadingUnderscore: true option. Must be added to camelcase first though.

@wizardpisces
Copy link

wizardpisces commented Oct 14, 2022

Any progress? Want to skip camelcase for BigNumber Object, it seems exclude support function would be more reasonable

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

No branches or pull requests

3 participants