Supports js_pairs on function objects. See #337