diff --git a/README.md b/README.md index de74f98..18a8cbc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ $ npm i valienv --save $ yarn add valienv ``` -## ๐Ÿ“˜ Basic usage +## ๐Ÿ“˜ Usage This library exports a main function: `validate`.
Using `validators`, you can parse, validate and type required environment variables (other variables will be excluded). @@ -50,7 +50,7 @@ export const env = validate({ _โš ๏ธ ย In case of incorrect environment variables, the function will throw an `EnvValidationError` exposing `invalidVariables` and `missingVariables` names (not their values) to prevent your application from starting._ -### overrides +#### overrides The `overrides` option is useful to override some variables in some contexts. @@ -78,8 +78,6 @@ export const env = validate({ _โš ๏ธ ย The values set has to be correctly typed but are **not** validated._ -## ๐Ÿ“• Advanced usage - ### Custom validators By default, `valienv` only exports 3 validators: `string`, `number` and `boolean`. It also offers `oneOf`, a helper to create validators for union of string literals. @@ -211,7 +209,7 @@ env.FOO.match({ ## โ“ Questions -### Why not handling `NODE_ENV` for us? +#### Why not handling `NODE_ENV` for us? Frontend bundlers generally **statically replace** `process.env.NODE_ENV` values at build time, allowing minifiers like [`terser`](https://github.com/terser/terser) to eliminate dead code from production build. Aliasing `NODE_ENV` would prevent such optimisations.
But if you are working with Node.js, feel free to use `oneOf` on `NODE_ENV` if you want.