refator: use error-first-handler

This commit is contained in:
Stephan Bönnemann
2015-02-03 20:45:03 +01:00
parent 19fd15c1dc
commit 019aeeabe1
8 changed files with 51 additions and 55 deletions
+6 -7
View File
@@ -2,13 +2,12 @@
var git = require('conventional-changelog/lib/git')
module.exports = function (cb) {
git.latestTag(function (err, from) {
if (err) return cb(err)
var efh = require('../error').efh
git.getCommits({from: from}, function (err, commits) {
if (err) return cb(err)
module.exports = function (cb) {
git.latestTag(efh(cb)(function (from) {
git.getCommits({from: from}, efh(cb)(function (commits) {
cb(null, commits)
})
})
}))
}))
}
+4 -5
View File
@@ -1,12 +1,11 @@
'use strict'
var commits = require('./commits')
var analyze = require('./analyze')
var commits = require('./commits')
var efh = require('../error').efh
module.exports = function (cb) {
commits(function (err, commits) {
if (err) return cb(err)
commits(efh(cb)(function (commits) {
cb(null, analyze(commits))
})
}))
}