Skip to content

Commit ee05c62

Browse files
author
Yunuuuu
committed
refactor: reorganize functions
1 parent 09f0e66 commit ee05c62

3 files changed

Lines changed: 9 additions & 14 deletions

File tree

R/combine.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ combine_faers_xml_data <- function(x) {
152152
)
153153
}
154154

155-
combine_faers_meddra <- function(lst, standardization, call = rlang::caller_env()) {
155+
combine_faers_meddra <- function(lst, standardization,
156+
call = rlang::caller_env()) {
156157
if (!standardization) {
157158
return(NULL)
158159
}

R/utils-assert.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ assert_inclusive <- function(x, y, allow_null = FALSE,
1313
), call = call)
1414
}
1515
}
16+
17+
assert_internet <- function(call = rlang::caller_env()) {
18+
if (!curl::has_internet()) {
19+
cli::cli_abort("No internet", call = call)
20+
}
21+
}

R/utils.R

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
`%||%` <- function(x, y) if (is.null(x)) y else x
22

3-
pkg_nm <- function() {
4-
utils::packageName(topenv(environment()))
5-
}
6-
73
quote_strings <- function(x, ...) {
84
oxford_comma(sprintf('"%s"', x), ...)
95
}
@@ -13,19 +9,11 @@ dt_shallow <- function(x) {
139
x[TRUE]
1410
}
1511

16-
assert_internet <- function(call = rlang::caller_env()) {
17-
if (!curl::has_internet()) {
18-
cli::cli_abort("No internet", call = call)
19-
}
20-
}
21-
2212
has_name <- function(x, name) {
2313
any(name == rlang::names2(x))
2414
}
2515

26-
fda_host <- function(prefix = "www") {
27-
sprintf("https://%s.fda.gov", prefix)
28-
}
16+
fda_host <- function(prefix = "www") sprintf("https://%s.fda.gov", prefix)
2917

3018
FAERS_FILE_FORMAT <- c("ascii", "xml")
3119
FAERS_FILE_QUARTERS <- c("q1", "q2", "q3", "q4")

0 commit comments

Comments
 (0)