fix(filterFilter): don't throw if key.charAt is not a function
Previously, when an object has keys which are not of type string, `filterFilter` would throw an exception for trying to call `key.charAt()`, which is a string method. This commit checks whether `charAt` is defined before calling it. Fixes #15644 Closes #15660
This commit is contained in:
committed by
Georgios Kalpakas
parent
a0641ea475
commit
2af2607fba
@@ -226,7 +226,10 @@ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstA
|
||||
var key;
|
||||
if (matchAgainstAnyProp) {
|
||||
for (key in actual) {
|
||||
if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
|
||||
// Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined
|
||||
// See: https://github.com/angular/angular.js/issues/15644
|
||||
if (key.charAt && (key.charAt(0) !== '$') &&
|
||||
deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user