conbench / conbenchcoms

Communicate with the conbench API in R
Other
0 stars 0 forks source link

Always return a data.frame #4

Closed boshek closed 1 year ago

boshek commented 1 year ago

Or a tibble.

When a run exists but no benchmarks are population an empty list is returned. We should coerce that to an empty data.frame (or tibble).

boshek commented 1 year ago

Some helper function like this would be ideal:

conbench_body_json <- function(resp, simplifyVector = simplifyVector, flatten = flatten, ...) {
  resp <- resp_body_json(resp, simplifyVector = simplifyVector, flatten = flatten, ...)

  if (length(resp) == 0) {
    return(as.data.frame(resp))
  } else {
    resp
  }
}