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

A minor convenience, but still nice to have.

There was some previous discussion that indicated that such a thing would be a welcome addition (https://github.com/paularmstrong/swig/pull/335) but that looks to have stalled a while ago.
Also, we should return something here, instead of `undefined` for cases where you try to get a length from a number or date object.