Feature: Return env as Object
- Dominant language
- JavaScript
- Stars
- 102
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
# Story
As a person wanting to know which which environment variables were in the `.env` file
I would like to have the environment variables that were _in_ the `.env` file returned as an `Object`
So that I can check if the var was loaded from a file or from another place.
Currently in our usage instructions: [https://github.com/dwyl/env2#use-in-your-code](https://github.com/dwyl/env2/tree/15a8bd4fa0a35647e21bc1107f1655a1bf0f4f6e#use-in-your-code)

We _hint_ at the possibility that the environment variables loaded by `env2`
are ***assigned*** to the `env` constant:
```
const env = require('env2')('./path-to-your/.env');
```
But reading the `code` we can see that no such `Object` is being returned:
https://github.com/dwyl/env2/blob/15a8bd4fa0a35647e21bc1107f1655a1bf0f4f6e/lib/env.js#L57-L60
We could return the `env` on line 38 and it would (_before the `catch` statement_):
https://github.com/dwyl/env2/blob/15a8bd4fa0a35647e21bc1107f1655a1bf0f4f6e/lib/env.js#L32-L38
This would not alter the _existing_ functionality of the package and would add this feature.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.