Function for replacing paramteres in a string with variables

@param string  {String} string with placeholders
@param params  {Object} object containing parameters
@param noError {Boolean} wheter to break on missing or corrupt values
@return {String}
function stringify(string, params, noError) {
  var arr = string.split(':');
  var param;
  for(var i = 0, c = arr.length; i < c; i++) {
    param = arr[i];
    if(i % 2){
      if(!(typeof params[param] === 'string' || typeof params[param] === 'number')){
        if(!noError){
          throw new Error('Variable ' + param + ' not defined');
        }
      } else {
        arr[i] = params[param];
      }
    }
  }
  return arr.join('');
}