Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ Kareem.prototype.execPre = function(name, context, args, callback) {
}
const pres = this._pres.get(name) || [];
const numPres = pres.length;
if (!numPres) {
return nextTick(function() {
callback(null);
});
}

const numAsyncPres = pres.numAsync || 0;
let currentPre = 0;
let asyncPresLeft = numAsyncPres;
let done = false;
const $args = args;
let shouldSkipWrappedFunction = null;

if (!numPres) {
return nextTick(function() {
callback(null);
});
}

function next() {
if (currentPre >= numPres) {
return;
Expand Down Expand Up @@ -179,7 +179,6 @@ Kareem.prototype.execPost = function(name, context, args, options, callback) {
}
const posts = this._posts.get(name) || [];
const numPosts = posts.length;
let currentPost = 0;

let firstError = null;
if (options && options.error) {
Expand All @@ -191,7 +190,8 @@ Kareem.prototype.execPost = function(name, context, args, options, callback) {
callback.apply(null, [firstError].concat(args));
});
}

let currentPost = 0;

function next() {
const post = posts[currentPost].fn;
let numArgs = 0;
Expand Down