Skip to content

Commit

Permalink
Consolidate the documentation ref #28
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Sep 25, 2023
1 parent 3bcce4b commit 7f0f442
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 182 deletions.
63 changes: 25 additions & 38 deletions R/has.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,81 +5,68 @@
func(utf8::as_utf8(url))
}

#' Check if URL has credentials
#' Check if URL has a certain component
#'
#' These functions check if URL has a certain component.
#' @inheritParams ada_url_parse
#' @return logical
#' @return logical, `NA` if not a valid URL.
#' @examples
#' ada_has_credentials("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' url <- c("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' ada_has_credentials(url)
#' ada_has_empty_hostname(url)
#' ada_has_hostname(url)
#' ada_has_non_empty_username(url)
#' ada_has_hostname(url)
#' ada_has_non_empty_username(url)
#' ada_has_non_empty_password(url)
#' ada_has_port(url)
#' ada_has_hash(url)
#' ada_has_search(url)
#' ## these functions are vectorized
#' urls <- c("http://www.google.com", "http://www.google.com:80", "noturl")
#' ada_has_port(urls)
#' @export
ada_has_credentials <- function(url) {
.has(url, Rcpp_ada_has_credentials)
}

#' Check if URL has an empty hostname
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_empty_hostname("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_empty_hostname <- function(url) {
.has(url, Rcpp_ada_has_empty_hostname)
}

#' Check if URL has a hostname
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_hostname("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_hostname <- function(url) {
.has(url, Rcpp_ada_has_hostname)
}

#' Check if URL has a non empty username
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_non_empty_username("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_non_empty_username <- function(url) {
.has(url, Rcpp_ada_has_non_empty_username)
}

#' Check if URL has a non empty password
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_non_empty_password("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_non_empty_password <- function(url) {
.has(url, Rcpp_ada_has_non_empty_password)
}

#' Check if URL has a port
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_port("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_port <- function(url) {
.has(url, Rcpp_ada_has_port)
}

#' Check if URL has a hash
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_hash("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_hash <- function(url) {
.has(url, Rcpp_ada_has_hash)
}

#' Check if URL has a search
#' @inheritParams ada_url_parse
#' @return logical
#' @examples
#' ada_has_search("https://user_1:[email protected]:8080/dir/../api?q=1#frag")
#' @rdname ada_has_credentials
#' @export
ada_has_search <- function(url) {
.has(url, Rcpp_ada_has_search)
Expand Down
42 changes: 38 additions & 4 deletions man/ada_has_credentials.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions man/ada_has_empty_hostname.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_hash.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_hostname.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_non_empty_password.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_non_empty_username.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_port.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ada_has_search.Rd

This file was deleted.

0 comments on commit 7f0f442

Please sign in to comment.