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

fix(filterFilter): do not filter objects properly in case a property is an array #10621

Conversation

fealaer
Copy link
Contributor

@fealaer fealaer commented Jan 2, 2015

In JavaScript, an array is a special type of object, therefore typeof [] returns object.
Added corresponding unit tests.
Changed condition for array type to isArray.

@@ -186,7 +186,7 @@ function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatc

if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
} else if (actualType === 'array') {
} else if (isArray(actual)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeeze @_@

@caitp
Copy link
Contributor

caitp commented Jan 2, 2015

Looks correct to me, but could you please fix the indentation in your tests? 2 space indentation

…is an array

In JavaScript, an array is a special type of object, therefore typeof [] returns object.
Added corresponding unit tests.
Changed condition for array type to isArray.
@fealaer fealaer force-pushed the fix-for-case-when-actual-is-an-array-in-deep-compare branch from 0b6a62e to 3df4285 Compare January 2, 2015 18:03
@caitp
Copy link
Contributor

caitp commented Jan 2, 2015

LGTM, just waiting on travis

caitp pushed a commit that referenced this pull request Jan 2, 2015
In JavaScript, an array is a special type of object, therefore typeof [] returns object.
Added corresponding unit tests.

Changed condition for array type to isArray.

Closes #10621
@caitp caitp closed this in a01ce6b Jan 2, 2015
@fealaer fealaer deleted the fix-for-case-when-actual-is-an-array-in-deep-compare branch January 3, 2015 09:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants