Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2bcc73f

Browse files
fix(filter): Don't throw key.charAt is not a function when object's keys are not of type string.
Previously, when an object has keys which are not of type string, the `filter` would throw an exception for trying to call `charAt`, which is not defined on a none-string type. This commit checks whether `charAt` is defined before calling it. Closes #15644
1 parent d03357a commit 2bcc73f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ng/filter/filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstA
226226
var key;
227227
if (matchAgainstAnyProp) {
228228
for (key in actual) {
229-
if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
229+
if (key.charAt && (key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
230230
return true;
231231
}
232232
}

0 commit comments

Comments
 (0)