File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,11 @@ function isString(what) {
39
39
}
40
40
41
41
function isEmptyObject ( what ) {
42
- for ( var _ in what ) return false ; // eslint-disable-line guard-for-in, no-unused-vars
42
+ for ( var _ in what ) {
43
+ if ( what . hasOwnProperty ( _ ) ) {
44
+ return false ;
45
+ }
46
+ }
43
47
return true ;
44
48
}
45
49
Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ describe('utils', function() {
64
64
it ( 'should work as advertised' , function ( ) {
65
65
assert . isTrue ( isEmptyObject ( { } ) ) ;
66
66
assert . isFalse ( isEmptyObject ( { foo : 1 } ) ) ;
67
+ var MyObj = function ( ) { } ;
68
+ MyObj . prototype . foo = 0 ;
69
+ assert . isTrue ( isEmptyObject ( new MyObj ( ) ) ) ;
70
+ var myExample = new MyObj ( ) ;
71
+ myExample . bar = 1 ;
72
+ assert . isFalse ( isEmptyObject ( myExample ) ) ;
67
73
} ) ;
68
74
} ) ;
69
75
You can’t perform that action at this time.
0 commit comments