thebarndog / swift-dotenv

Swift micro-package for loading .env environment files
MIT License
29 stars 8 forks source link

[Feature] - CamelCase dynamic subscripting #13

Closed thebarndog closed 2 years ago

thebarndog commented 2 years ago

Context

This PR introduces the ability to subscript the environment with dynamic key paths in camel case and have them translate to snake case keys in the .env file.

Example:

If your .env file looks like

API_KEY=SOME_API_KEY

you can now subscript on the environment like

print(env.apiKey)

which will convert the camel case dynamic access to the uppercased snake case format used in the environment file.