This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -860,8 +860,8 @@ function equals(o1, o2) {
860
860
} else if ( isDate ( o1 ) ) {
861
861
if ( ! isDate ( o2 ) ) return false ;
862
862
return equals ( o1 . getTime ( ) , o2 . getTime ( ) ) ;
863
- } else if ( isRegExp ( o1 ) && isRegExp ( o2 ) ) {
864
- return o1 . toString ( ) == o2 . toString ( ) ;
863
+ } else if ( isRegExp ( o1 ) ) {
864
+ return isRegExp ( o2 ) ? o1 . toString ( ) == o2 . toString ( ) : false ;
865
865
} else {
866
866
if ( isScope ( o1 ) || isScope ( o2 ) || isWindow ( o1 ) || isWindow ( o2 ) || isArray ( o2 ) ) return false ;
867
867
keySet = { } ;
Original file line number Diff line number Diff line change @@ -547,6 +547,7 @@ describe('angular', function() {
547
547
expect ( equals ( new Date ( undefined ) , new Date ( 0 ) ) ) . toBe ( false ) ;
548
548
expect ( equals ( new Date ( undefined ) , new Date ( null ) ) ) . toBe ( false ) ;
549
549
expect ( equals ( new Date ( undefined ) , new Date ( 'wrong' ) ) ) . toBe ( true ) ;
550
+ expect ( equals ( new Date ( ) , / a b c / ) ) . toBe ( false ) ;
550
551
} ) ;
551
552
552
553
it ( 'should correctly test for keys that are present on Object.prototype' , function ( ) {
@@ -564,6 +565,7 @@ describe('angular', function() {
564
565
expect ( equals ( / a b c / , / d e f / ) ) . toBe ( false ) ;
565
566
expect ( equals ( / ^ a b c / , / a b c / ) ) . toBe ( false ) ;
566
567
expect ( equals ( / ^ a b c / , '/^abc/' ) ) . toBe ( false ) ;
568
+ expect ( equals ( / a b c / , new Date ( ) ) ) . toBe ( false ) ;
567
569
} ) ;
568
570
569
571
it ( 'should return false when comparing an object and an array' , function ( ) {
You can’t perform that action at this time.
0 commit comments