simplify checks for object and regex