code: function interpolate(template, context, options) {
  
    template = template || ''
    options = options || {}
    context = context || {}
  
    var json = options.json
      , patterns = options.patterns || ['[%]']
      , raw_patterns = options.raw_patterns || ['{{%}}']
  
    function replace(pattern, key, json) {
      var val = context[key]
        , re = makePattern(pattern, key)
  
      template = template.replace(re, function() {
        return json ? JSON.stringify(val) : val
      })
    }
  
    // escape special regex characters and insert key name
    function makePattern(pattern, key) {
      return new RegExp(regexSafe(pattern).replace('%', key), 'g')
    }
  
    for (var key in context) {
      if (!context.hasOwnProperty(key)) continue
  
      _.each(patterns, function(pattern) {
        replace(pattern, key, json)
      })
  
      _.each(raw_patterns, function(pattern) {
        replace(pattern, key)
      })
    }
  
    return template
  }
docs: Internal: interpolate values, like templating
  
  template - a String template to interpolate into
  context - an Object of variable bindings
  json - a Boolean, whether to interpret the template as JSON
  
  Returns a String