UNPKG

361 BJavaScriptView Raw
1function substitute(str, o) {
2 if (!str || !o) {
3 return str;
4 }
5 return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) {
6 if (match.charAt(0) === '\\') {
7 return match.slice(1);
8 }
9 return (o[name] === undefined) ? '' : o[name];
10 });
11}
12export default substitute;
13//# sourceMappingURL=substitute.js.map
\No newline at end of file