export default function substitute(str, obj) { return str.replace(/\{([^{}]+)\}/g, (match, key) => { if (obj[key] !== undefined) { return String(obj[key]); } return `{${key}}`; }); }