Skip to content

Commit

Permalink
Ensure README snippets are up to StandardJS (#149)
Browse files Browse the repository at this point in the history
* Add standard-markdown package

Also fix standard violations in README.md

* Add postlint hook for lint-md
  • Loading branch information
djds23 authored and maxbeatty committed Aug 8, 2016
1 parent 1e73f00 commit 6349be8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ npm install dotenv --save
As early as possible in your application, require and configure dotenv.

```javascript
require('dotenv').config();
require('dotenv').config()
```

Create a `.env` file in the root directory of your project. Add
Expand All @@ -38,11 +38,12 @@ That's it.
`process.env` now has the keys and values you defined in your `.env` file.

```javascript
var db = require('db')
db.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
password: process.env.DB_PASS
});
})
```

### Preload
Expand Down Expand Up @@ -78,7 +79,7 @@ Dotenv outputs a warning to your console if missing a `.env` file. Suppress
this warning using silent.

```js
require('dotenv').config({silent: true});
require('dotenv').config({silent: true})
```

#### Path
Expand All @@ -89,7 +90,7 @@ You can specify a custom path if your file containing environment variables is
named or located differently.

```js
require('dotenv').config({path: '/custom/path/to/your/env/vars'});
require('dotenv').config({path: '/custom/path/to/your/env/vars'})
```

#### Encoding
Expand All @@ -100,7 +101,7 @@ You may specify the encoding of your file containing environment variables
using this option.

```js
require('dotenv').config({encoding: 'base64'});
require('dotenv').config({encoding: 'base64'})
```

## Parse
Expand All @@ -110,9 +111,9 @@ variables is available to use. It accepts a String or Buffer and will return
an Object with the parsed keys and values.

```js
var dotenv = require('dotenv');
var buf = new Buffer('BASIC=basic');
var config = dotenv.parse(buf); // will return an object
var dotenv = require('dotenv')
var buf = new Buffer('BASIC=basic')
var config = dotenv.parse(buf) // will return an object
console.log(typeof config, config) // object { BASIC : 'basic' }
```

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"test": "lab test/* -r lcov | coveralls",
"posttest": "npm run lint",
"lint": "standard"
"postlint": "npm run lint-md",
"lint": "standard",
"lint-md": "standard-markdown"
},
"repository": {
"type": "git",
Expand All @@ -31,7 +33,8 @@
"semver": "5.0.3",
"should": "7.1.0",
"sinon": "1.16.1",
"standard": "5.3.0"
"standard": "5.3.0",
"standard-markdown": "^1.1.1"
},
"dependencies": {}
}

0 comments on commit 6349be8

Please sign in to comment.