Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Fix hook order execution & argument consistency. #14

Closed
Closed
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions lib/before.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ module.exports = function(service) {
result[name].push(fn);
});
});

var self = this;

_.each(mixin, function(hooks, method){
_.each(hooks, function(hook){
// Reverse loop so hooks execute in correct order.
_.eachRight(hooks, function(hook){
var obj = {};
obj[method] = hook;
self.mixin(obj);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports.hookObject = function(method, args) {

exports.makeArguments = function(hookObject) {
var result = [];
if(hookObject.id) {
if(typeof hookObject.id !== 'undefined') {
result.push(hookObject.id);
}

Expand Down