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

Camelcase capital letters misunderstood by DelimiterCase type #197

Closed
finnmerlett opened this issue Mar 31, 2021 · 2 comments
Closed

Camelcase capital letters misunderstood by DelimiterCase type #197

finnmerlett opened this issue Mar 31, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@finnmerlett
Copy link

finnmerlett commented Mar 31, 2021

Can we get the DelimiterCase type to understand the following camelcase examples?

type Test = SnakeCase<'VATNumber'>; // expected 'VAT_number', found '_v_a_t_number'
type Test2 = SnakeCase<'returnAPICall'>; // expected 'return_API_call', found 'return_a_p_i_call'

The rule could be: two capital letters in a row = converted to two words with no capitals, three capital letters or more in a row = converted to two words with the first word in uppercase and the second word starting with the last of the capital letters, but in lowercase.

And also perhaps these PascalCase examples could be fixed? (this is not for my usecase though)

type Test3 = SnakeCase<'OAuth'>; // expected 'o_auth', found '_o_auth'
type Test4 = SnakeCase<'FeedAKitten'>; // expected 'feed_a_kitten', found '_feed_a_kitten'

I do understand this might be hideously complicated/impossible to implement - I just thought I'd ask in case!

@sindresorhus sindresorhus added bug Something isn't working help wanted Extra attention is needed labels Apr 2, 2021
@voxpelli
Copy link
Collaborator

voxpelli commented Sep 22, 2021

Sorry, I know this one was submitted first, but its the same issue as in #223 and there have been some more comments there, so I'm closing this in favor of that, but only because of that, else I would have done the reverse.

Also of interest, and very similar: #224 (comment)

@voxpelli
Copy link
Collaborator

Duplicate of #223

@voxpelli voxpelli marked this as a duplicate of #223 Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants