Update the compiled version.

This commit is contained in:
Veselin Todorov 2012-02-29 21:58:06 +02:00
parent 670f128970
commit 15f67bad72

10
chai.js
View file

@ -433,10 +433,16 @@ Object.defineProperty(Assertion.prototype, 'exist',
Object.defineProperty(Assertion.prototype, 'empty',
{ get: function () {
new Assertion(this.obj).to.have.property('length');
var expected = this.obj;
if (Array.isArray(this.obj)) {
expected = this.obj.length;
} else if (typeof this.obj === 'object') {
expected = Object.keys(this.obj).length;
}
this.assert(
0 === this.obj.length
!expected
, 'expected ' + this.inspect + ' to be empty'
, 'expected ' + this.inspect + ' not to be empty');