Skip to content

Commit

Permalink
Use correct post parameters in wrap()
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 13, 2014
1 parent 65621d8 commit 9bb5da3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -150,12 +150,14 @@ Kareem.prototype.wrap = function(name, fn, context, args) {

fn.apply(context, args.slice(0, end).concat(function() {
if (arguments[0]) {
// Assume error
return typeof lastArg === 'function' ?
lastArg(arguments[0]) :
undefined;
}

_this.execPost(name, context, args.slice(0, end), function() {
var argsWithoutError = Array.prototype.slice.call(arguments, 1);
_this.execPost(name, context, argsWithoutError, function() {
if (arguments[0]) {
return typeof lastArg === 'function' ?
lastArg(arguments[0]) :
Expand Down
2 changes: 1 addition & 1 deletion test/examples.test.js
Expand Up @@ -208,7 +208,7 @@ describe('wrap()', function() {
assert.equal(4, obj.eggs);
assert.equal(false, obj.waffles);
assert.equal(undefined, obj.tofu);
callback();
callback(null, o);
},
obj,
args);
Expand Down

0 comments on commit 9bb5da3

Please sign in to comment.