reduce different treatment between object and array