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

Feature: camel, pascal, snake, kebab and dot case styles for string #162

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hugo-pcl
Copy link

Add new case styles extension for String.

  • camelCase with camel()
  • PascalCase with pascal()
  • snake_case with snake()
  • kebab-case with kebab()
  • dot.case with dot()

Usage

'Hello World'.camel(); // helloWorld
'Hello World'.pascal(); // HelloWorld
'Hello World'.snake(); // hello_world
'Hello World'.kebab(); // hello-world
'Hello World'.dot(); // hello.world

See tests for more examples.

@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #162 (84450ec) into master (6465f00) will decrease coverage by 0.16%.
The diff coverage is 93.10%.

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
- Coverage   97.83%   97.67%   -0.17%     
==========================================
  Files          13       13              
  Lines         787      816      +29     
==========================================
+ Hits          770      797      +27     
- Misses         17       19       +2     
Impacted Files Coverage Δ
lib/src/string.dart 97.89% <93.10%> (-2.11%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@passsy
Copy link
Collaborator

passsy commented Jul 11, 2022

This is pretty much what https://pub.dev/packages/recase offers. And I'd love to have them provided by dartx.

I don't mind, having the functionality duplicated here. But I have some questions I personally don't yet have answers to:

  • Instead of implementing it again, could we just export recase?
  • Why methods, not getters?
  • Should those methods end with Case, i.e. snakeCase()?

👍 for better documentation than recase 😉

@arthurbcd
Copy link

Recase is highly used right now.
https://pub.dev/packages/recase.

Let's just use the same convention that most people are used to.

Can we just export it like @passsy said?

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.

3 participants