Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseCssColors(): treat incoming NAs as an invalid color #194

Merged
merged 4 commits into from
Dec 2, 2020
Merged

Conversation

cpsievert
Copy link
Collaborator

Closes #161

…n (instead of throwing with an unintelligible error. Closes #161
Copy link
Collaborator

@wch wch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Can you also add a NEWS item?

tests/testthat/test-colors.R Outdated Show resolved Hide resolved
R/colors.R Outdated
# Note that an empty string is not a valid color, so parsing fails
# on NA input values, and thus, will be converted back to NA
# when `mustWork = FALSE`
if (!(is.character(str) || rlang::is_na(str))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what about the cases where it's a vector of (non-character) NAs? As in:

parseCssColors(c(NA, NA))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason I was thinking that'd be a character vector, but I suppose logical makes way more sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parseCssColors errors on missing value
2 participants