-
Notifications
You must be signed in to change notification settings - Fork 34
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
Keys ending with numbers fail to snake_case #119
Comments
This seems like an opinion rather than a correctness issue: https://stackoverflow.com/questions/58009622/whats-the-correct-way-to-treat-numbers-in-snake-case In which case I'm not especially inclined to pursue a breaking change. |
Could this offered as a configurable option, especially since the consensus in that opinion favors what I'm suggesting here? It would also be beneficial for this library to at least offer comparable functionality to popular libraries like Example with option: const object = {
foo01: "value",
};
snakecaseKeys(object, { separateNumbers: true });
// { foo_01: "value" } |
Probably not, as maintaining variations on what snake case means becomes very complex. And bringing in multiple libraries to handle those is both complex and bloats the package. I'll certainly accept a PR that makes the snake case function an option so you can pass your own. |
Fair points — I love that idea better! |
Due to the way the
snake-case
package handles numbers, keys ending with numbers aren't being properly snake_cased.Example keys:
Whereas
lodash
's snakeCase utility does properly separate numbers from alphabetical characters:This may mean this library's underlying case conversion library would need to be swapped, or updated, but unfortunately it hasn't been maintained in several years.
The text was updated successfully, but these errors were encountered: