Skip to content

Commit

Permalink
fix: Missing implementation of string argument shorthand.
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakertack committed Jul 30, 2017
1 parent a641d1e commit 21a0d19
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.0.3] - 2017-07-30
### Fixed
- Implement string argument shorthand that was advertised in readme but overlooked during development.

## [1.0.2] - 2017-07-30
### Added
- This changelog, with descriptions starting from v1.0.0.
Expand Down
13 changes: 8 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
var fs = require('fs');

function nvar({
path = '.env',
source = null,
target = process.env
} = {}) {
function nvar(opts) {
if (typeof opts === 'string') opts = {path: opts}; // String argument shorthand.
let {
path = '.env',
source = null,
target = process.env
} = (opts || {});

// Get the input.
if (!source) source = fs.readFileSync(path, 'utf8');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nvar",
"version": "1.0.2",
"version": "1.0.3",
"description": "Adds environment variables declared in a `.env` file to your app's `process.env`. Useful during development.",
"main": "lib/index.js",
"engines": {"node": ">=6.0"},
Expand Down

0 comments on commit 21a0d19

Please sign in to comment.