MarcoKun
Results
1
comments of
MarcoKun
``` javascript function render(template, context) { return template.replace(/\{\{(.*?)\}\}/g,(match,key)=>{ let arr =key.split('.') return arr.reduce((pre,cur)=>{ return pre[cur.trim()] },context) }) } const template = "{{name}}很厉害,才{{age }}岁,就可以帮{{person.father}}做事,{{deep.a.b}}"; const context = { name: "marcKun", age:...