UNPKG

@kahi-ui/framework

Version:

Straight-forward Svelte UI for the Web

10 lines (9 loc) 302 B
const EXPRESSION_TOKEN = /\${([\w\._]+)}/g; export function format_tokens(input, tokens) { return input.replace(EXPRESSION_TOKEN, (match, token) => { const value = tokens[token]; if (typeof value === "undefined") return token; return value.toString(); }); }