Git Product home page Git Product logo

Comments (5)

stancl avatar stancl commented on August 21, 2024 1

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.

stancl avatar stancl commented on August 21, 2024 1

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.

stancl avatar stancl commented on August 21, 2024

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.

stancl avatar stancl commented on August 21, 2024

Oops accidentally overrode the test for pure PascalCase enum when I was adding the test for the backed enum.

Fixed here 61ba793

from enums.

dereuromark avatar dereuromark commented on August 21, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.