Skip to content

Commit

Permalink
removed to_singular and to_plural
Browse files Browse the repository at this point in the history
  • Loading branch information
mustberuss committed Dec 5, 2024
1 parent 213bb77 commit 53eee8e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
37 changes: 0 additions & 37 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,3 @@ format_num <- function(x) {
big.mark = ",", scientific = FALSE, trim = TRUE
)
}

#' @noRd
to_singular <- function(plural) {
# ipcr and wipo are funky exceptions. On assignees and other_references
# we only want to remove the "s", not the "es"

if (plural == "ipcr") {
singular <- "ipc"
} else if (plural == "wipo") {
singular <- plural
} else if (endsWith(plural, "classes")) {
singular <- sub("es$", "", plural)
} else {
singular <- sub("s$", "", plural)
}
singular
}


#' @noRd
to_plural <- function(singular) {
# wipo endpoint returns singular wipo as the entity

# remove the patent/ and publication/ from nested endpoints when present
singular <- sub("^(patent|publication)/", "", singular)

if (singular == "ipc") {
plural <- "ipcr"
} else if (singular == "wipo") {
plural <- singular
} else if (endsWith(singular, "s")) {
plural <- paste0(singular, "es")
} else {
plural <- paste0(singular, "s")
}
plural
}
15 changes: 0 additions & 15 deletions tests/testthat/test-utils.R

This file was deleted.

0 comments on commit 53eee8e

Please sign in to comment.