Skip to content

Commit

Permalink
chore: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed Feb 12, 2020
2 parents ab86a14 + e74f97b commit d1b0c85
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

## 6.0.1 (12/02/20)
* Fix typings for the `default(value)` function.

## 6.0.0 (12/02/20)
* Add support for setting an example value via the `example(string)` function.
* Passing default values is now performed using the `default(string)` function.
Expand Down
4 changes: 2 additions & 2 deletions env-var.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface IPresentVariable {
* Set a default value for this variable. This will be used if a value is not
* set in the process environment
*/
default: (value: string) => IPresentVariable;
default: (value: string|number|Record<string, any>|Array<any>) => IPresentVariable;

/**
* Ensures the variable is set on process.env. If it's not set an exception
Expand Down Expand Up @@ -136,7 +136,7 @@ interface IOptionalVariable {
* Set a default value for this variable. This will be used if a value is not
* set in the process environment
*/
default: (value: string) => IPresentVariable;
default: (value: string|number|Record<string, any>|Array<any>) => IPresentVariable;

/**
* Ensures the variable is set on process.env. If it's not set an exception will be thrown.
Expand Down
2 changes: 1 addition & 1 deletion example/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ if (!url) {
console.log('url is', url)

// Integers
const requiredInt = env.get('AN_INTEGER').required().asInt()
const requiredInt = env.get('AN_INTEGER').default(10).required().asInt()

console.log('the integer was', requiredInt)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "env-var",
"version": "6.0.0",
"version": "6.0.1",
"description": "Verification, sanatization, and type coercion for environment variables in Node.js",
"main": "env-var.js",
"typings": "env-var.d.ts",
Expand Down Expand Up @@ -60,7 +60,7 @@
"mocha-lcov-reporter": "~1.3.0",
"nyc": "~15.0.0",
"standard": "~14.3.0",
"typescript": "~3.1.3"
"typescript": "~3.7.5"
},
"engines": {
"node": ">=8"
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"target": "es5",
"moduleResolution": "node",
"skipLibCheck": true,
"strict": true
"strict": true,
"strictNullChecks": true
},
"files": ["test/types/index.ts"]
"files": ["test/types/index.ts", "example/typescript.ts"]
}

0 comments on commit d1b0c85

Please sign in to comment.