UNPKG

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