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) {
3939}
4040
4141function 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+ }
4347 return true ;
4448}
4549
Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ describe('utils', function() {
6464 it ( 'should work as advertised' , function ( ) {
6565 assert . isTrue ( isEmptyObject ( { } ) ) ;
6666 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 ) ) ;
6773 } ) ;
6874 } ) ;
6975
You can’t perform that action at this time.
0 commit comments