Function asObject

Returns x if x is an object (including array), otherwise returns {} (empty object).