the string template
Optional
values: Record<string, any> | ValueResolverrecord of values or a lookup function
a string with all ${key}
expressions replaced by matching values in valueLookup
.
Replace ${key}
using object as key to value mapping
import {replace} from "apprt-core/string-replace";
let msg = replace("${name} says ${msg}", { msg: "hello" });
msg === "${name} says hello"; // true
Replacing ${key}
using custom value lookup function
import {replace} from "apprt-core/string-replace";
let msg = replace("${name} says ${msg}", (key) => key === "msg" ? "hello" : "");
msg === " says hello"; // true
Generated using TypeDoc
A default string replace function with the default options.