主题
使用搜索表达式用数据对象中的值模板化字符串
给定一个字符串、一个数据对象和一个要搜索的格式表达式,返回一个字符串,其中所有匹配搜索的元素都被数据对象中匹配的值替换。
import { template } from 'radash' template('It is {{color}}', { color: 'blue' }) // => It is blue template('It is <color>', { color: 'blue' }, /<(.+?)>/g) // => It is blue