trevorld / bittermelon
Showing 2 of 7 files from the diff.
Other files ignored by Codecov
DESCRIPTION has changed.
NAMESPACE has changed.
NEWS.md has changed.

@@ -1,10 +1,13 @@
Loading
1 1
#' Other Unicode utilities
2 2
#'
3 3
#' `ucp2label()` returns Unicode code point \dQuote{labels} as a character vector.
4 +
#' `ucp_sort()` sorts Unicode code points.
4 5
#' `is_combining_character()` returns `TRUE` if the character is a \dQuote{combining} character.
5 6
#'
6 7
#' @param x A character vector of Unicode code points.
8 +
#' @param decreasing If `TRUE` do a decreasing sort.
7 9
#' @return `ucp2label()` returns a character vector of Unicode labels.
10 +
#'         `ucp_sort()` returns a character vector of Unicode code points.
8 11
#'         `is_combining_character()` returns a logical vector.
9 12
#' @examples
10 13
#'   # Get the Unicode Code Point "label" for "R"
@@ -12,13 +15,20 @@
Loading
12 15
#'
13 16
#'   is_combining_character(str2ucp("a"))
14 17
#'   is_combining_character("U+0300") # COMBINING GRAVE ACCENT
15 -
#' @seealso [hex2ucp()], [int2ucp()], [name2ucp()], and [str2ucp()] all return Unicode code points.
18 +
#' @seealso [block2ucp()], [hex2ucp()], [int2ucp()], [name2ucp()], [range2ucp()], and [str2ucp()]
19 +
#'           all return Unicode code points.
16 20
#' @rdname unicode_utilities
17 21
#' @export
18 22
ucp2label <- function(x) {
19 23
    Unicode::u_char_label(x)
20 24
}
21 25
26 +
#' @rdname unicode_utilities
27 +
#' @export
28 +
ucp_sort <- function(x, decreasing = FALSE) {
29 +
    int2ucp(sort(as.integer(Unicode::as.u_char(x)), decreasing = decreasing))
30 +
}
31 +
22 32
#' @rdname unicode_utilities
23 33
#' @export
24 34
is_combining_character <- function(x) {

@@ -131,7 +131,7 @@
Loading
131 131
}
132 132
133 133
label2ucp <- function(labels) {
134 -
        labels <- ucp_sort(labels)
134 +
        labels <- yaff_ucp_sort(labels)
135 135
        ucp <- sapply(labels, yaff2ucp_helper)
136 136
        ucp <- Filter(Negate(is.na), ucp)[1]
137 137
        if (is.na(ucp))
@@ -139,7 +139,7 @@
Loading
139 139
        ucp
140 140
}
141 141
142 -
ucp_sort <- function(x) {
142 +
yaff_ucp_sort <- function(x) {
143 143
    uplus <- base::which(toupper(substr(x, 1, 2)) == "U+")
144 144
    if (length(uplus))
145 145
        c(x[uplus], x[-uplus])
Files Coverage
R 92.10%
Project Totals (37 files) 92.10%
Untitled

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading