Comments (5)
Hey, thanks for bringing this up.
I'd like to support all of these cases with sane defaults. So probably something like:
UPPERCASE_SNAKE_CASE => 'Uppercase snake case'
PascalCase => 'Pascal case'
The option values would remain the same as the case names (for pure enums, without a backing value) so that you can use fromName()
.
from enums.
Ah that makes sense. I think with the changes I made here, all logic should be 1:1 consistent for both UPPER_SNAKE_CASE and PascalCase enum cases, so now the only remaining step would be to make the README consistent with the more standard syntax?
from enums.
See the linked commit and let me know if that's how you'd intuitively expect it to behave (I included tests for both backed enums and pure enums). If it looks fine I'll tag a release, thanks!
from enums.
Oops accidentally overrode the test for pure PascalCase enum when I was adding the test for the backed enum.
Fixed here 61ba793
from enums.
I think my main point was that it could be useful to have
https://github.com/archtechx/enums?tab=readme-ov-file#usage
in line with the standard recommendation for it from PHP side using CamelCase
https://www.php.net/manual/en/language.types.enumerations.php
For people to use that mainly, and having upper case as optional thing, but not what usually would be used.
from enums.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enums.