Socket
Socket
Sign inDemoInstall

minimatch

Package Overview
Dependencies
3
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.1 to 4.2.0

41

minimatch.js

@@ -794,9 +794,38 @@ const minimatch = module.exports = (p, pattern, options = {}) => {

let re = set.map(pattern =>
pattern.map(p =>
(p === GLOBSTAR) ? twoStar
: (typeof p === 'string') ? regExpEscape(p)
// coalesce globstars and regexpify non-globstar patterns
// if it's the only item, then we just do one twoStar
// if it's the first, and there are more, prepend (\/|twoStar\/)? to next
// if it's the last, append (\/twoStar|) to previous
// if it's in the middle, append (\/|\/twoStar\/) to previous
// then filter out GLOBSTAR symbols
let re = set.map(pattern => {
pattern = pattern.map(p =>
typeof p === 'string' ? regExpEscape(p)
: p === GLOBSTAR ? GLOBSTAR
: p._src
).join('\\\/')
).join('|')
).reduce((set, p) => {
if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
set.push(p)
}
return set
}, [])
pattern.forEach((p, i) => {
if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) {
return
}
if (i === 0) {
if (pattern.length > 1) {
pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1]
} else {
pattern[i] = twoStar
}
} else if (i === pattern.length - 1) {
pattern[i-1] += '(?:\\\/|' + twoStar + ')?'
} else {
pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1]
pattern[i+1] = GLOBSTAR
}
})
return pattern.filter(p => p !== GLOBSTAR).join('/')
}).join('|')

@@ -803,0 +832,0 @@ // must match entire pattern

3

package.json

@@ -5,3 +5,3 @@ {

"description": "a glob matcher in javascript",
"version": "4.1.1",
"version": "4.2.0",
"repository": {

@@ -14,2 +14,3 @@ "type": "git",

"test": "tap",
"snap": "tap",
"preversion": "npm test",

@@ -16,0 +17,0 @@ "postversion": "npm publish",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc