micromatch 3.1.4 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of micromatch might be problematic. Click here for more details.

package/index.js CHANGED
@@ -738,11 +738,6 @@ micromatch.parse = function(pattern, options) {
738
738
  var snapdragon = utils.instantiate(null, options);
739
739
  parsers(snapdragon, options);
740
740
 
741
- if (pattern.slice(0, 2) === './') {
742
- pattern = pattern.slice(2);
743
- }
744
-
745
- pattern = utils.combineDuplicates(pattern, '\\*\\*\\/|\\/\\*\\*');
746
741
  var ast = snapdragon.parse(pattern, options);
747
742
  utils.define(ast, 'snapdragon', snapdragon);
748
743
  ast.input = pattern;
package/lib/utils.js CHANGED
@@ -120,22 +120,19 @@ utils.isObject = function(val) {
120
120
  };
121
121
 
122
122
  /**
123
- * Combines duplicate characters in the provided string.
124
- * @param {String} `str`
125
- * @returns {String}
123
+ * Returns true if the given `str` has special characters
126
124
  */
127
125
 
128
- utils.combineDuplicates = function(str, val) {
129
- var re = new RegExp('(' + val + ')(?=(?:' + val + ')*\\1)', 'g');
130
- return str.replace(re, '');
126
+ utils.hasSpecialChars = function(str) {
127
+ return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
131
128
  };
132
129
 
133
130
  /**
134
- * Returns true if the given `str` has special characters
131
+ * Escape regex characters in the given string
135
132
  */
136
133
 
137
- utils.hasSpecialChars = function(str) {
138
- return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
134
+ utils.escapeRegex = function(str) {
135
+ return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&');
139
136
  };
140
137
 
141
138
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "micromatch",
3
3
  "description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
4
- "version": "3.1.4",
4
+ "version": "3.1.5",
5
5
  "homepage": "https://github.com/micromatch/micromatch",
6
6
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
7
  "contributors": [