formio-sfds
Version:
form.io templates for the SF Design System
17 lines (12 loc) • 410 B
JavaScript
import interpolate from 'interpolate'
// ugh, FIXME! this pollutes the global namespace
import 'uri-template-lite'
const { URI } = window
export { uriTemplate, interp }
function uriTemplate (template) {
const uri = new URI.Template(template)
return data => uri.expand(data)
}
function interp (template, data) {
return (typeof template === 'function') ? template(data) : interpolate(template, data)
}