Learn R Programming

pater (version 1.0.0)

compile: Build a function for transforming parameters into a valid path

Description

The output function will have one parameter in which you can specify the parameters using a named list.

Usage

compile(path, delimiter = "/", encode)

Value

A function.

Arguments

path

A character vector or a tokenData object.

delimiter

A character vector of length 1. Specifies the delimiter for the path segments.

encode

Function to encode input strings. Defaults to utils::URLencode with the parameter reserved set to TRUE.

Examples

Run this code

toPath <- compile("/path/to/resource/:Id")
toPath(list(Id = "2"))

toPath <- compile("public/*files")
toPath(list(files = c("js", "hi.js")))

Run the code above in your browser using DataLab