Skip to content

Commit

Permalink
🔪 simplify code, just call file_ext instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Patrick Kyle committed Mar 5, 2019
1 parent 1bbd09d commit 8da24be
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,8 @@ get_package_mapping <- function(script_name, url_package, dependencies) {
}

get_mimetype <- function(filename) {
# the next two lines are borrowed from file_ext
last_dot_pos <- regexpr("\\.([[:alnum:]]+)$", filename)
file_ext <- ifelse(last_dot_pos > -1L,
substring(filename,
last_dot_pos + 1L),
"")
# the tools package is available to all
filename_ext <- tools::file_ext(filename)

if (file_ext == 'js')
return('application/JavaScript')
Expand Down

0 comments on commit 8da24be

Please sign in to comment.