mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
Simplify adding language chains with a check for the getter argument
This commit is contained in:
parent
67a3ca5109
commit
8f8f186058
2 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue