Skip to content

Commit e3d83fb

Browse files
committed
relax non-strict case a bit
1 parent d6a3b21 commit e3d83fb

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

R/let.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,19 @@ prepareAlias <- function(alias, strict) {
5555
nulls <- vapply(names(alias), is.null, logical(1)) |
5656
vapply(alias, is.null, logical(1))
5757
alias <- alias[!nulls]
58-
# confirm alias is an invertable mapping strings to strings
5958
if (length(unique(names(alias))) != length(names(alias))) {
6059
stop('wrapr::prepareAlias alias keys must be unique')
6160
}
62-
if (length(unique(as.character(alias))) != length(alias)) {
63-
stop('wrapr::prepareAlias alias values must be unique')
61+
if(strict) {
62+
# confirm alias is an invertable mapping strings to strings
63+
if (length(unique(as.character(alias))) != length(alias)) {
64+
stop('wrapr::prepareAlias alias values must be unique')
65+
}
6466
}
65-
if ('.' %in% c(names(alias),as.character(alias))) {
66-
stop("wrapr::prepareAlias can not map to/from '.'")
67+
if(strict) {
68+
if ('.' %in% c(names(alias),as.character(alias))) {
69+
stop("wrapr::prepareAlias can not map to/from '.'")
70+
}
6771
}
6872
for (ni in names(alias)) {
6973
if (is.null(ni)) {
@@ -291,7 +295,7 @@ letprep_lang <- function(alias, lexpr) {
291295
#' @param expr block to prepare for execution.
292296
#' @param ... force later arguments to be bound by name.
293297
#' @param subsMethod character substitution method, one of c('langsubs', 'stringsubs', 'subsubs').
294-
#' @param strict logical if TRUE names must be valid un-quoted names.
298+
#' @param strict logical if TRUE names and values must be valid un-quoted names, not dot, and unique values.
295299
#' @param eval logical if TRUE execute the re-mapped expression (else return it).
296300
#' @param debugPrint logical if TRUE print debugging information when in stringsubs mode.
297301
#' @return result of expr executed in calling environment (or expression if eval==FALSE).

man/let.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)