Skip to content

Commit

Permalink
Merge pull request #499 from Daveloper87/empty_string_check_fix
Browse files Browse the repository at this point in the history
Shortened check for empty
  • Loading branch information
keithamus committed Jul 24, 2015
2 parents bad5fa7 + bba85d0 commit 8aea7a5
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,8 @@ module.exports = function (chai, _) {
*/

Assertion.addProperty('empty', function () {
var obj = flag(this, 'object')
, expected = obj;

if (Array.isArray(obj) || 'string' === typeof object) {
expected = obj.length;
} else if (typeof obj === 'object') {
expected = Object.keys(obj).length;
}

this.assert(
!expected
Object.keys(Object(flag(this, 'object'))).length === 0
, 'expected #{this} to be empty'
, 'expected #{this} not to be empty'
);
Expand Down

0 comments on commit 8aea7a5

Please sign in to comment.