@@ -403,6 +403,18 @@ function isArray(value) {
403
403
function isFunction ( value ) { return typeof value == 'function' ; }
404
404
405
405
406
+ /**
407
+ * Determines if a value is a regular expression object.
408
+ *
409
+ * @private
410
+ * @param {* } value Reference to check.
411
+ * @returns {boolean } True if `value` is a `RegExp`.
412
+ */
413
+ function isRegExp ( value ) {
414
+ return toString . apply ( value ) == '[object RegExp]' ;
415
+ }
416
+
417
+
406
418
/**
407
419
* Checks if `obj` is a window object.
408
420
*
@@ -622,14 +634,17 @@ function shallowCopy(src, dst) {
622
634
* @function
623
635
*
624
636
* @description
625
- * Determines if two objects or two values are equivalent. Supports value types, arrays and
637
+ * Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and
626
638
* objects.
627
639
*
628
640
* Two objects or values are considered equivalent if at least one of the following is true:
629
641
*
630
642
* * Both objects or values pass `===` comparison.
631
643
* * Both objects or values are of the same type and all of their properties pass `===` comparison.
632
644
* * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)
645
+ * * Both values represent the same regular expression (In JavasScript,
646
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
647
+ * representation matches).
633
648
*
634
649
* During a property comparision, properties of `function` type and properties with names
635
650
* that begin with `$` are ignored.
@@ -656,6 +671,8 @@ function equals(o1, o2) {
656
671
}
657
672
} else if ( isDate ( o1 ) ) {
658
673
return isDate ( o2 ) && o1 . getTime ( ) == o2 . getTime ( ) ;
674
+ } else if ( isRegExp ( o1 ) && isRegExp ( o2 ) ) {
675
+ return o1 . toString ( ) == o2 . toString ( ) ;
659
676
} else {
660
677
if ( isScope ( o1 ) || isScope ( o2 ) || isWindow ( o1 ) || isWindow ( o2 ) ) return false ;
661
678
keySet = { } ;
@@ -912,9 +929,9 @@ function encodeUriQuery(val, pctEncodeSpaces) {
912
929
* one ngApp directive can be used per HTML document. The directive
913
930
* designates the root of the application and is typically placed
914
931
* at the root of the page.
915
- *
916
- * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
917
- * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
932
+ *
933
+ * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
934
+ * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
918
935
* Applications cannot be nested.
919
936
*
920
937
* In the example below if the `ngApp` directive would not be placed
0 commit comments