caitlinChang

Results 1 comments of caitlinChang

``` function render(template,context){ let reg = /\{\{\s*\w+(\.\w+)*\s*\}\}/g return template.replace(reg,function(match){ return match.replace(/{|}/g,'').trim().split('.').reduce((prev,cur) => prev[cur],context) }) } let context = { name:'lily', age:18, family:{ count:3 } } let template = '{{ name...