Skip to content

Commit

Permalink
πŸ› Correctly parse boolean input even if it is string
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaHuhn committed Feb 1, 2021
1 parent 8c0b2d5 commit 512a553
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25688,13 +25688,14 @@ const getVar = ({ key, default: dft, required = false, type = 'string' }) => {

if (coreVar !== undefined && coreVar.length >= 1) {
if (type === 'array') return coreVar.split('\n')
if (type === 'boolean') return String(coreVar) === 'true'

return coreVar
}

if (envVar !== undefined && envVar.length >= 1) {
if (type === 'array') return envVar.split(',')
if (type === 'boolean') return envVar === 'true'
if (type === 'boolean') return String(envVar) === 'true'

return envVar
}
Expand Down
3 changes: 2 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ const getVar = ({ key, default: dft, required = false, type = 'string' }) => {

if (coreVar !== undefined && coreVar.length >= 1) {
if (type === 'array') return coreVar.split('\n')
if (type === 'boolean') return String(coreVar) === 'true'

return coreVar
}

if (envVar !== undefined && envVar.length >= 1) {
if (type === 'array') return envVar.split(',')
if (type === 'boolean') return envVar === 'true'
if (type === 'boolean') return String(envVar) === 'true'

return envVar
}
Expand Down

0 comments on commit 512a553

Please sign in to comment.