fix(filter): throw error if not used with an array

Throw error if filter is not used with an array.

Closes #9992

BREAKING CHANGE: Previously, the filter was not applied if used with a non array.
Now, it throws an error.
this test isn't needed --- what is really being tested is that the object isn't being stringified in the usual javascript way, which depends on `toString()` and `valueOf()` --- if n'either of them can be used, the JS engine will throw a TypeError.

Try this in your web console: `'' + {toString: null, valueOf: null}` --- it will throw.