code: function(str, varName, varValue){
      if(str === varName) return varValue;
      var strType = typeof varValue === "string", ln = str.length;
      var patt = (strType || (str.indexOf('{{') !== 0 || str.indexOf('}}') !== (ln-2))) ? varName : '"'+varName+'"';
      var rValue = strType ? varValue : JSON.stringify(varValue);
      return str.replace(patt,function(){ return rValue; });
    }
docs: replaces a single variable (only variable) in the string, if exists