Skip to content

Commit

Permalink
refactor: drop stringr dependency
Browse files Browse the repository at this point in the history
- refactor: drop stringr dependency
- refactor: import stringstatic + isstatic functions
  • Loading branch information
elipousson committed Jan 10, 2023
1 parent 92afe8d commit 2606292
Show file tree
Hide file tree
Showing 5 changed files with 667 additions and 43 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Imports:
purrr,
rlang,
sf,
stringr,
tibble,
units,
vctrs
Expand Down Expand Up @@ -62,4 +61,4 @@ Config/testthat/parallel: true
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
3 changes: 1 addition & 2 deletions R/get_asp.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#' @inheritParams get_paper
#' @inheritDotParams get_paper
#' @export
#' @importFrom stringr str_extract
get_asp <- function(asp = NULL,
paper = NULL,
orientation = NULL,
Expand Down Expand Up @@ -45,7 +44,7 @@ get_asp <- function(asp = NULL,
switch(type,
"null" = asp,
"num" = asp,
"char" = as.numeric(stringr::str_extract(asp, ".+(?=:)")) / as.numeric(stringr::str_extract(asp, "(?<=:).+")),
"char" = as.numeric(str_extract(asp, ".+(?=:)")) / as.numeric(str_extract(asp, "(?<=:).+")),
"paper" = get_paper(paper = paper, orientation = orientation, bbox = bbox, ...)[["asp"]],
"block" = get_paper(paper = paper, orientation = orientation, bbox = bbox, margin = margin, ...)[["block_asp"]],
"bbox" = sf_bbox_asp(bbox)
Expand Down
8 changes: 4 additions & 4 deletions R/read_sf_ext.R
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ read_sf_gmap <- function(url,
#' Get map ID from url
#' @noRd
get_gmap_id <- function(url) {
stringr::str_extract(
str_extract(
url,
"(?<=mid=)([:alnum:]|_)+((?=&)|(?=/$)|$)"
regex("(?<=mid=)([[:alnum:]]|_)+((?=&)|(?=/$)|$)")
)
}

Expand Down Expand Up @@ -1013,9 +1013,9 @@ make_sf_query <- function(dsn = NULL,

table <-
table %||%
stringr::str_extract(
str_extract(
basename(dsn),
"[:graph:]+(?=\\.)"
regex("[[:graph:]]+(?=\\.)")
)

table <-
Expand Down
Loading

0 comments on commit 2606292

Please sign in to comment.