add a length filter that works for objects as well as arrays and strings

A minor convenience, but I was surprised to see that there isn't a length filter.

There was some previous discussion that seemed to indicate that it would be a welcome addition (https://github.com/paularmstrong/swig/pull/335) but that looks to have stalled a while ago.