Simplify adding language chains with a check for the getter argument

This commit is contained in:
lucasfcosta 2016-03-20 16:07:02 -03:00
parent 67a3ca5109
commit 8f8f186058
2 changed files with 3 additions and 3 deletions

View file

@ -43,9 +43,7 @@ module.exports = function (chai, _) {
, 'is', 'and', 'has', 'have'
, 'with', 'that', 'which', 'at'
, 'of', 'same', 'but' ].forEach(function (chain) {
Assertion.addProperty(chain, function () {
return this;
});
Assertion.addProperty(chain);
});
/**

View file

@ -35,6 +35,8 @@ var transferFlags = require('./transferFlags');
*/
module.exports = function (ctx, name, getter) {
getter = getter === undefined ? new Function() : getter;
Object.defineProperty(ctx, name,
{ get: function addProperty() {
var old_ssfi = flag(this, 'ssfi');