code: function parsePattern(pattern) {
  	var regexSpecialChars = /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g;
  	// Treat consecutive wildcards as one (#12)
  	var wildCardPattern = /\*+/g;
  	var endOfLinePattern = /\\\$$/;
  
  	pattern = normaliseEncoding(pattern)
  
  	if (pattern.indexOf('*') < 0 && pattern.indexOf('$') < 0) {
  		return pattern;
  	}
  
  	pattern = pattern
  		.replace(regexSpecialChars, '\\$&')
  		.replace(wildCardPattern, '(?:.*)')
  		.replace(endOfLinePattern, '$');
  
  	return new RegExp(pattern);
  }
docs: Converts the pattern into a regexp if it is a wildcard
  pattern.
  
  Returns a string if the pattern isn't a wildcard pattern
  
  @param  {string} pattern
  @return {string|RegExp}
  @private