Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export sanitizers for easier use #4

Open
mattbishop opened this issue Aug 29, 2020 · 1 comment
Open

Export sanitizers for easier use #4

mattbishop opened this issue Aug 29, 2020 · 1 comment

Comments

@mattbishop
Copy link

The current out-of-the-box sanitizers are great, but a bit odd to use because you have to declare a new function to access them. It would be easier if they were exported, so this:

const useLocal = env("APP_ONLINE", x => x.asBoolean(), true)

becomes this:

const useLocal = env("APP_ONLINE", env.asBoolean, true)

Or, even easier:

const useLocal = env.asBoolean("APP_ONLINE", true)

@tal952
Copy link
Owner

tal952 commented Sep 8, 2020

Hey,
I really like:
const useLocal = env.asBoolean("APP_ONLINE", true)

The only problem is that We could not chain operations, but chaining is not that important.
The standard usage will benefit greatly with a syntactic sugar like this.
Would you like to contribute a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants