code: function(str, obj) {
        var isStringOrNumber = function(a) {
          var t = typeof a;
          return t === 'string' || t === 'number';
        };
  
        return str.replace(/\${([^{}]*)}/g,
          function (a, b) {
            var value = obj[b];
            return isStringOrNumber(value) ? value : a;
          }
        );
      }
docs: Given a string and object, perform template-replacements on the string, as specified by the object.
  Any template fields of the form ${name} are replaced by the string or number specified as obj["name"]
  Based on Douglas Crockford's 'supplant' method for template-replace of strings. Uses different template format.