Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Add defaultOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Aug 19, 2017
1 parent e494eee commit 7ed8002
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ isTrue()

```js
/* examples/index.js */
export const envVars = [
const envVars = [
'LOG_LEVEL',
'FOO_API',
// ...
Expand Down
6 changes: 4 additions & 2 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export const examples = {
isTrue // TODO: Replace this with added example.
}

export const envVars = [
const envVars = [
'LOG_LEVEL'
]

const defaultOptions = {}

const envOptions = env => Object.assign.apply({}, [{},
...envVars.filter(k => env[k] !== undefined)
.map(k => ({[camelCase(k)]: env[k]}))]
Expand All @@ -24,7 +26,7 @@ const envOptions = env => Object.assign.apply({}, [{},
const localOptions = local => (
fs.existsSync(local)
? JSON.parse(fs.readFileSync(local))
: {}
: defaultOptions
)

const createExample = (name, {
Expand Down

0 comments on commit 7ed8002

Please sign in to comment.