From 7f0f442cfb5d3f76790718eac6e1d33605a56e79 Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Mon, 25 Sep 2023 10:24:27 +0200 Subject: [PATCH] Consolidate the documentation ref #28 --- R/has.R | 63 ++++++++++++------------------- man/ada_has_credentials.Rd | 42 +++++++++++++++++++-- man/ada_has_empty_hostname.Rd | 20 ---------- man/ada_has_hash.Rd | 20 ---------- man/ada_has_hostname.Rd | 20 ---------- man/ada_has_non_empty_password.Rd | 20 ---------- man/ada_has_non_empty_username.Rd | 20 ---------- man/ada_has_port.Rd | 20 ---------- man/ada_has_search.Rd | 20 ---------- 9 files changed, 63 insertions(+), 182 deletions(-) delete mode 100644 man/ada_has_empty_hostname.Rd delete mode 100644 man/ada_has_hash.Rd delete mode 100644 man/ada_has_hostname.Rd delete mode 100644 man/ada_has_non_empty_password.Rd delete mode 100644 man/ada_has_non_empty_username.Rd delete mode 100644 man/ada_has_port.Rd delete mode 100644 man/ada_has_search.Rd diff --git a/R/has.R b/R/has.R index 5325547..596cf35 100644 --- a/R/has.R +++ b/R/has.R @@ -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:password_1@example.org:8080/dir/../api?q=1#frag") +#' url <- c("https://user_1:password_1@example.org: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:password_1@example.org: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:password_1@example.org: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:password_1@example.org: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:password_1@example.org: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:password_1@example.org: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:password_1@example.org: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:password_1@example.org:8080/dir/../api?q=1#frag") +#' @rdname ada_has_credentials #' @export ada_has_search <- function(url) { .has(url, Rcpp_ada_has_search) diff --git a/man/ada_has_credentials.Rd b/man/ada_has_credentials.Rd index 4f3bad1..b13cc8a 100644 --- a/man/ada_has_credentials.Rd +++ b/man/ada_has_credentials.Rd @@ -2,19 +2,53 @@ % Please edit documentation in R/has.R \name{ada_has_credentials} \alias{ada_has_credentials} -\title{Check if URL has credentials} +\alias{ada_has_empty_hostname} +\alias{ada_has_hostname} +\alias{ada_has_non_empty_username} +\alias{ada_has_non_empty_password} +\alias{ada_has_port} +\alias{ada_has_hash} +\alias{ada_has_search} +\title{Check if URL has a certain component} \usage{ ada_has_credentials(url) + +ada_has_empty_hostname(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) } \arguments{ \item{url}{character. one or more URL to be parsed} } \value{ -logical +logical, \code{NA} if not a valid URL. } \description{ -Check if URL has credentials +These functions check if URL has a certain component. } \examples{ -ada_has_credentials("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") +url <- c("https://user_1:password_1@example.org: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) } diff --git a/man/ada_has_empty_hostname.Rd b/man/ada_has_empty_hostname.Rd deleted file mode 100644 index d687961..0000000 --- a/man/ada_has_empty_hostname.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_empty_hostname} -\alias{ada_has_empty_hostname} -\title{Check if URL has an empty hostname} -\usage{ -ada_has_empty_hostname(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has an empty hostname -} -\examples{ -ada_has_empty_hostname("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_hash.Rd b/man/ada_has_hash.Rd deleted file mode 100644 index 9cbe36b..0000000 --- a/man/ada_has_hash.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_hash} -\alias{ada_has_hash} -\title{Check if URL has a hash} -\usage{ -ada_has_hash(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a hash -} -\examples{ -ada_has_hash("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_hostname.Rd b/man/ada_has_hostname.Rd deleted file mode 100644 index 6f1a8bc..0000000 --- a/man/ada_has_hostname.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_hostname} -\alias{ada_has_hostname} -\title{Check if URL has a hostname} -\usage{ -ada_has_hostname(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a hostname -} -\examples{ -ada_has_hostname("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_non_empty_password.Rd b/man/ada_has_non_empty_password.Rd deleted file mode 100644 index 5ee0fce..0000000 --- a/man/ada_has_non_empty_password.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_non_empty_password} -\alias{ada_has_non_empty_password} -\title{Check if URL has a non empty password} -\usage{ -ada_has_non_empty_password(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a non empty password -} -\examples{ -ada_has_non_empty_password("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_non_empty_username.Rd b/man/ada_has_non_empty_username.Rd deleted file mode 100644 index 3cd2224..0000000 --- a/man/ada_has_non_empty_username.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_non_empty_username} -\alias{ada_has_non_empty_username} -\title{Check if URL has a non empty username} -\usage{ -ada_has_non_empty_username(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a non empty username -} -\examples{ -ada_has_non_empty_username("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_port.Rd b/man/ada_has_port.Rd deleted file mode 100644 index 994da5e..0000000 --- a/man/ada_has_port.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_port} -\alias{ada_has_port} -\title{Check if URL has a port} -\usage{ -ada_has_port(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a port -} -\examples{ -ada_has_port("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -} diff --git a/man/ada_has_search.Rd b/man/ada_has_search.Rd deleted file mode 100644 index 09b854c..0000000 --- a/man/ada_has_search.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/has.R -\name{ada_has_search} -\alias{ada_has_search} -\title{Check if URL has a search} -\usage{ -ada_has_search(url) -} -\arguments{ -\item{url}{character. one or more URL to be parsed} -} -\value{ -logical -} -\description{ -Check if URL has a search -} -\examples{ -ada_has_search("https://user_1:password_1@example.org:8080/dir/../api?q=1#frag") -}