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

Closed
wants to merge 3 commits into 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

Attention: Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.67%. Comparing base (6465f00) to head (84450ec).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/string.dart 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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?

@hugo-pcl hugo-pcl closed this Mar 21, 2025
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