Skip to content

Commit f5fff43

Browse files
committed
npmPkg: Use a named list instead of a char vector
1 parent a513900 commit f5fff43

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/scaffold.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#'
66
#' @param name Name of widget
77
#' @param npmPkg Optional \href{https://npmjs.com/}{NPM} package upon which this
8-
#' widget is based, as a two-element character vector of name and
9-
#' \href{https://docs.npmjs.com/files/package.json#dependencies}{version
10-
#' range}. If you specify this parameter the package will be added to the
8+
#' widget is based, a named list with two elements: \code{name} and
9+
#' \href{https://docs.npmjs.com/files/package.json#dependencies}{version}. If
10+
#' you specify this parameter the package will be added to the
1111
#' \code{dependency} section of the generated \code{package.json}.
1212
#' @param edit Automatically open the widget's JavaScript source file after
1313
#' creating the scaffolding.
@@ -41,7 +41,7 @@ toDepJSON <- function(npmPkg) {
4141
if (is.null(npmPkg)) {
4242
""
4343
} else {
44-
do.call(sprintf, as.list(c('"%s": "%s"', npmPkg)))
44+
sprintf('"%s": "%s"', npmPkg$name, npmPkg$version)
4545
}
4646
}
4747

0 commit comments

Comments
 (0)