Skip to content

Commit

Permalink
addProperty: Prevent unnecessary transferFlags() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Mar 31, 2016
1 parent 49697a6 commit 218dd94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/chai/utils/addProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ module.exports = function (ctx, name, getter) {
flag(this, 'ssfi', addProperty);

var result = getter.call(this);
if (result !== undefined)
return result;

var newAssertion = new chai.Assertion();
transferFlags(this, newAssertion);

return result === undefined ? newAssertion: result;
return newAssertion;
}
, configurable: true
});
Expand Down

0 comments on commit 218dd94

Please sign in to comment.