@@ -413,6 +413,18 @@ function isArray(value) {
413
413
function isFunction ( value ) { return typeof value == 'function' ; }
414
414
415
415
416
+ /**
417
+ * Determines if a value is a regular expression object.
418
+ *
419
+ * @private
420
+ * @param {* } value Reference to check.
421
+ * @returns {boolean } True if `value` is a `RegExp`.
422
+ */
423
+ function isRegExp ( value ) {
424
+ return toString . apply ( value ) == '[object RegExp]' ;
425
+ }
426
+
427
+
416
428
/**
417
429
* Checks if `obj` is a window object.
418
430
*
@@ -646,14 +658,17 @@ function shallowCopy(src, dst) {
646
658
* @function
647
659
*
648
660
* @description
649
- * Determines if two objects or two values are equivalent. Supports value types, arrays and
661
+ * Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and
650
662
* objects.
651
663
*
652
664
* Two objects or values are considered equivalent if at least one of the following is true:
653
665
*
654
666
* * Both objects or values pass `===` comparison.
655
667
* * Both objects or values are of the same type and all of their properties pass `===` comparison.
656
668
* * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)
669
+ * * Both values represent the same regular expression (In JavasScript,
670
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
671
+ * representation matches).
657
672
*
658
673
* During a property comparison, properties of `function` type and properties with names
659
674
* that begin with `$` are ignored.
@@ -680,6 +695,8 @@ function equals(o1, o2) {
680
695
}
681
696
} else if ( isDate ( o1 ) ) {
682
697
return isDate ( o2 ) && o1 . getTime ( ) == o2 . getTime ( ) ;
698
+ } else if ( isRegExp ( o1 ) && isRegExp ( o2 ) ) {
699
+ return o1 . toString ( ) == o2 . toString ( ) ;
683
700
} else {
684
701
if ( isScope ( o1 ) || isScope ( o2 ) || isWindow ( o1 ) || isWindow ( o2 ) ) return false ;
685
702
keySet = { } ;
@@ -949,9 +966,9 @@ function encodeUriQuery(val, pctEncodeSpaces) {
949
966
* one ngApp directive can be used per HTML document. The directive
950
967
* designates the root of the application and is typically placed
951
968
* at the root of the page.
952
- *
953
- * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
954
- * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
969
+ *
970
+ * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
971
+ * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
955
972
* Applications cannot be nested.
956
973
*
957
974
* In the example below if the `ngApp` directive would not be placed
0 commit comments