Skip to content

Commit 02c4d66

Browse files
committed
lint: standard
1 parent cb839af commit 02c4d66

File tree

5 files changed

+137
-132
lines changed

5 files changed

+137
-132
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
coverage
3+
*.log

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44
sudo: false
55
language: node_js
66
script:
7+
- npm run lint
78
- npm run test-travis
89
- npm run bench
910
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = compose
1818
* @api public
1919
*/
2020

21-
function compose(middleware){
21+
function compose (middleware) {
2222
if (!Array.isArray(middleware)) throw new TypeError('Middleware stack must be an array!')
2323
for (const fn of middleware) {
2424
if (typeof fn !== 'function') throw new TypeError('Middleware must be composed of functions!')
@@ -34,16 +34,16 @@ function compose(middleware){
3434
// last called middleware #
3535
let index = -1
3636
return dispatch(0)
37-
function dispatch(i) {
37+
function dispatch (i) {
3838
if (i <= index) return Promise.reject(new Error('next() called multiple times'))
3939
index = i
4040
const fn = middleware[i] || next
4141
if (!fn) return Promise.resolve()
4242
try {
43-
return Promise.resolve(fn(context, function next() {
43+
return Promise.resolve(fn(context, function next () {
4444
return dispatch(i + 1)
4545
}))
46-
} catch(err) {
46+
} catch (err) {
4747
return Promise.reject(err)
4848
}
4949
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
"istanbul": "^0.4.2",
2020
"matcha": "^0.6.1",
2121
"mocha": "^2.4.5",
22-
"should": "^2.0.0"
22+
"should": "^2.0.0",
23+
"standard": "^6.0.8"
2324
},
2425
"scripts": {
2526
"bench": "matcha bench/bench.js",
27+
"lint": "standard index.js test/*.js",
2628
"test": "mocha --require should --reporter spec",
2729
"test-cov": "node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --require should",
2830
"test-travis": "node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- --require should"

0 commit comments

Comments
 (0)