var toString = require('../lang/toString')
var get = require('../object/get')

var stache = /\{\{([^\}]+)\}\}/g; //mustache-like

function interpolate (template, replacements, syntax) {
  template = toString(template)
  var replaceFn = function (match, prop) {
    return toString(get(replacements, prop))
  }
  return template.replace(syntax || stache, replaceFn)
}

module.exports = interpolate

@@ -257,16 +257,19 @@
 p) %7B%0A   
+ //
  return 
@@ -304,17 +304,200 @@
 rop))%0A  
-%7D
+  var template = toString(get(replacements, prop))%0A    return stache.test(template)%0A      ? template.replace(syntax %7C%7C stache, replaceFn)%0A      : toString(get(replacements, prop))%0A  %7D%0A
 %0A  retur

update string/interpolate.js