Skip to content

Commit

Permalink
Merge 91be1ad into d6d0dec
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin103 committed Feb 8, 2020
2 parents d6d0dec + 91be1ad commit af3f96d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Env/index.js
Expand Up @@ -166,6 +166,26 @@ class Env {
return _.get(process.env, key, defaultValue)
}

/**
* Get a boolean for a given key from the `process.env`
* object.
*
* @method boolean
*
* @param {String} key
* @param {Mixed} [defaultValue = null]
*
* @return {Boolean}
*
* @example
* ```js
* Env.boolean('CACHE_VIEWS', false)
* ```
*/
boolean (key, defaultValue = null) {
return /^true$/i.test(_.get(process.env, key, defaultValue))
}

/**
* Get value for a given key from the `process.env`
* object or throw an error if the key does not exist.
Expand Down

0 comments on commit af3f96d

Please sign in to comment.