R/aaa_utils.R

Defines functions nonull

Documented in nonull

#' Exclude NULL elements from a list
#' @note adapted by
#' \url{https://github.com/rstudio/leaflet/blob/master/R/utils.R}
#' @param x A list whose NULL elements will be filtered
#' @export
#' @examples
#' nonull(NULL)
nonull <- function(x) {
  if (length(x) == 0 || !is.list(x)) return(x)
  x[!unlist(lapply(x, is.null))]
}
muschellij2/papayaWidget documentation built on Aug. 20, 2021, 1:55 a.m.