Fix so passing a function as the 'items.visible' works

This fixes items.visible as a function to work as documented.  The
issue is that a Function is also an ECMAscript Object, so need to check
that first (or improve the is_object check)