Skip to content

Commit

Permalink
update changelog. bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed Oct 28, 2016
1 parent 0aee6c1 commit c057662
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.2.0 (28 October 2016)
* Thanks to @itavy for a patch for our _asBool_ parsing and adding the new
_asStrictBool_ function

## 2.1.0 (25 October 2016)
* Added _env.mock_ PR from @MikeyBurkman to improve testability

## 2.0.0 (27 July 2016)
* Add CI process for node 6, 5, 4, and 0.10
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var MAX_BATCH_SIZE = env('MAX_BATCH_SIZE').required().asInt();
```

When it comes to testing code that relies on environment variables this is also
great since you can mock out *env-var* using *proxyquire* to easily alter
great since you can mock out *env-var* using *proxyquire* to easily alter
results returned without having to share state via *process.env*. A
demonstration of this is at the bottom of the README.

Expand Down Expand Up @@ -110,13 +110,13 @@ String. It's highly unlikely that a variable will not be a String since all

#### asBool()
Attempt to parse the variable to a Boolean. Throws an exception if parsing
fails. The var must be set to either "true", "false" (and any case writing of
those two strings), 0 or 1 to succeed.
fails. The var must be set to either "true", "false" (upper or lowercase),
0 or 1 to succeed.

#### asStrictBool()
Attempt to parse the variable to a Boolean. Throws an exception if parsing
fails. The var must be set to either "true" or "false" (and any case writing
of those two strings) to succeed.
fails. The var must be set to either "true" or "false" (upper or lowercase) to
succeed.

#### asJson()
Attempt to parse the variable to a JSON Object. Throws an exception if parsing
Expand Down Expand Up @@ -160,9 +160,9 @@ When testing code that relies on environment variables sometimes we need to
mock out/set the environment variables. Having calls to _process.env_ strewn
throughout a test is and can get confusing and modifies global state (not good).

It's better to use *env-var* and its built-in `mock()` function. Using `mock()`
It's better to use *env-var* and its built-in `mock()` function. Using `mock()`
will allow you to create a mocked version of env-var which will use a literal
object **instead** of using _process.env_. You can use this mocked version with
object **instead** of using _process.env_. You can use this mocked version with
something like Proxyquire. For example:

```js
Expand Down Expand Up @@ -211,3 +211,7 @@ describe('concat.js', function () {
});

```

## Contributors
* @MikeyBurkman
* @itavy
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "env-var",
"version": "2.1.0",
"version": "2.2.0",
"description": "programmatic wrapper for process.env with support for defaults",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit c057662

Please sign in to comment.