How to convert to CONSTANT_CASE
- Paste your names into the top box, one per line.
- The CONSTANT_CASE version appears in the result box.
- Copy and paste it into your code or your
.envfile.
Examples
| Input | CONSTANT_CASE |
|---|---|
| max upload size | MAX_UPLOAD_SIZE |
| apiBaseUrl | API_BASE_URL |
| default-timeout | DEFAULT_TIMEOUT |
Where it is used
- Constants in JavaScript, Java, Python, PHP, C and C++, for values that never change, like
PIorSECONDS_PER_DAY. - Environment variables in
.envfiles, Docker and CI pipelines. - Enum values in many languages, for example
ORDER_STATUS_SHIPPED. - Redux action types like
ADD_TO_CARTin older React code.
Why developers like it
The capitals act as a warning sign. When you see TAX_RATE in the middle of some code, you know straight away it is a fixed value set somewhere else and you should not reassign it. That small visual hint prevents a surprising number of bugs.