Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanbirdie authored and chengjianhua committed Sep 20, 2019
1 parent a378420 commit 6f78a08
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Installation](#installation)
- [Usage](#usage)
- [Basic](#basic)
- [With default value](#with-default-value)
- [Advanced](#advanced)
- [Issues](#issues)
- [License](#license)
Expand Down Expand Up @@ -63,6 +64,24 @@ const BASE_URL = env({
const BASE_URL = (() => 'https://production.example.com')()
```

### With default value

```javascript
import env from 'penv.macro'

const BASE_URL = env(
{
development: 'https://development.example.com',
staging: 'https://staging.example.com',
production: (() => 'https://production.example.com')(),
},
'defaultValue',
)

// Assume that the value of `process.env.NODE_ENV` didn't match anything
const BASE_URL = 'defaultValue'
```

### Advanced

The default [node](https://nodejs.org/en/) environment variable used to determine which property value would
Expand Down

0 comments on commit 6f78a08

Please sign in to comment.