get_post_custom single array

this is what I’ve done to achieve this, it will return single dimension array when single results are found, and bi-dimensional array when multiple results are found

/*
 * Get post custom Single (in functions.php)
 */

function get_post_custom_single($post_id) {
  $metas = get_post_custom($post_id);

  foreach($metas as $key => $value) {
    if(sizeof($value) == 1) {
      $metas[$key] = $value[0];
    }
  }
  return $metas;
}