Consistent way to do object/class reflection in javascript