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

Change NS() to return a vectorized function #1613

Merged
merged 4 commits into from Mar 21, 2017
Merged

Change NS() to return a vectorized function #1613

merged 4 commits into from Mar 21, 2017

Conversation

wch
Copy link
Collaborator

@wch wch commented Mar 21, 2017

Previously, NS had this behavior:

ns <- NS(c("one", "two"))
ns(c("three", "four"))
# [1] "one-two-three-four"

But it make more sense for the ns() function (the one which was returned by NS()) to return a vector. Now it does this:

ns <- NS(c("one", "two"))
ns(c("three", "four"))
# [1] "one-two-three" "one-two-four" 

The code ended up being more complex than I expected, but I didn't see a simpler way to do it.

@wch wch added the review label Mar 21, 2017
R/shiny.R Outdated
if (length(ns_prefix) == 0)
return(id)

paste(ns_prefix, id, sep = "-")
Copy link
Member

Choose a reason for hiding this comment

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

sep = "-" should be sep = ns.sep?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, fixed.

@jcheng5
Copy link
Member

jcheng5 commented Mar 21, 2017

LGTM!

@wch wch merged commit 45fca42 into master Mar 21, 2017
@wch wch deleted the wch-vectorized-ns branch March 21, 2017 20:57
@wch wch removed the review label Mar 21, 2017
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.

None yet

2 participants