Skip to content

Commit

Permalink
remove combineDupes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Jan 8, 2018
1 parent b59d910 commit af682a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
5 changes: 0 additions & 5 deletions index.js
Expand Up @@ -738,11 +738,6 @@ micromatch.parse = function(pattern, options) {
var snapdragon = utils.instantiate(null, options);
parsers(snapdragon, options);

if (pattern.slice(0, 2) === './') {
pattern = pattern.slice(2);
}

pattern = utils.combineDuplicates(pattern, '\\*\\*\\/|\\/\\*\\*');
var ast = snapdragon.parse(pattern, options);
utils.define(ast, 'snapdragon', snapdragon);
ast.input = pattern;
Expand Down
15 changes: 6 additions & 9 deletions lib/utils.js
Expand Up @@ -120,22 +120,19 @@ utils.isObject = function(val) {
};

/**
* Combines duplicate characters in the provided string.
* @param {String} `str`
* @returns {String}
* Returns true if the given `str` has special characters
*/

utils.combineDuplicates = function(str, val) {
var re = new RegExp('(' + val + ')(?=(?:' + val + ')*\\1)', 'g');
return str.replace(re, '');
utils.hasSpecialChars = function(str) {
return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
};

/**
* Returns true if the given `str` has special characters
* Escape regex characters in the given string
*/

utils.hasSpecialChars = function(str) {
return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
utils.escapeRegex = function(str) {
return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&');
};

/**
Expand Down

0 comments on commit af682a2

Please sign in to comment.