UNPKG
@kahi-ui/framework
Version:
latest (0.6.4)
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.14
0.4.13
0.4.12
0.4.11
0.4.10
0.4.9
0.4.8
0.4.7
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.16
Straight-forward Svelte UI for the Web
github.com/novacbn/kahi-ui
novacbn/kahi-ui
@kahi-ui/framework
/
util
/
string.js
10 lines
(9 loc)
•
302 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
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
(); }); }