import { reduce } from 'lodash' ; param string param options export function template ( source , data ? ) { if ( ! data ) { return source ; } return reduce ( data , ( r , v , k ) => r . replace ( new RegExp ( `{\\s*${ k }\\s*}` , 'g' ) , v ) , source ) ; }