getNameError = function(name, typeName) {
  // checks if name is null, undefined or empty
  if (azureutil.stringIsEmpty(name)) {
    return new ArgumentNullError('name', util.format('%s name must be a non empty string.', typeName));
  }

  // check if name is between 3 and 63 characters
  if (name.length < 3 || name.length > 63) {
    return new ArgumentError('name', util.format('%s name must be between 3 and 63 characters long.', typeName));
  }

  // check if name follows naming rules
  if (name.match(/^([a-z0-9]+(-[a-z0-9]+)*)$/) === null) {
    return new SyntaxError(util.format('%s name format is incorrect.', typeName));
  }

  return null;
}
Validates a function.

@param {object} function The function to validate.
@return {function}