Socket
Socket
Sign inDemoInstall

picomatch

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

picomatch - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

30

index.js

@@ -0,8 +1,20 @@

/*global navigator*/
'use strict';
const os = require('os');
const pico = require('./lib/picomatch');
const isWindows = os.platform() === 'win32';
const isWindows = () => {
if (typeof navigator !== 'undefined' && navigator.platform) {
const platform = navigator.platform.toLowerCase();
return platform === 'win32' || platform === 'windows';
}
if (typeof process !== 'undefined' && process.platform) {
return process.platform === 'win32';
}
return false;
};
function picomatch(glob, options, returnState = false) {

@@ -12,17 +24,9 @@ // default to os.platform()

// don't mutate the original options object
options = { ...options, windows: isWindows };
options = { ...options, windows: isWindows() };
}
return pico(glob, options, returnState);
}
Object.assign(picomatch, pico);
module.exports = picomatch;
// public api
module.exports.test = pico.test;
module.exports.matchBase = pico.matchBase;
module.exports.isMatch = pico.isMatch;
module.exports.parse = pico.parse;
module.exports.scan = pico.scan;
module.exports.compileRe = pico.compileRe;
module.exports.toRegex = pico.toRegex;
// for tests
module.exports.makeRe = pico.makeRe;

@@ -212,4 +212,4 @@ 'use strict';

if (prev && prev.type === 'text' && tok.type === 'text') {
prev.output = (prev.output || prev.value) + tok.value;
prev.value += tok.value;
prev.output = (prev.output || '') + tok.value;
return;

@@ -702,6 +702,2 @@ }

if (next === '<' && !utils.supportsLookbehinds()) {
throw new Error('Node.js v10 or higher is required for regex lookbehinds');
}
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {

@@ -708,0 +704,0 @@ output = `\\${value}`;

@@ -22,12 +22,2 @@ 'use strict';

exports.supportsLookbehinds = () => {
if (typeof process !== 'undefined') {
const segs = process.version.slice(1).split('.').map(Number);
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
return true;
}
}
return false;
};
exports.escapeLast = (input, char, lastIdx) => {

@@ -34,0 +24,0 @@ const idx = input.lastIndexOf(char, lastIdx);

{
"name": "picomatch",
"description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
"version": "3.0.1",
"version": "4.0.0",
"homepage": "https://github.com/micromatch/picomatch",

@@ -18,2 +18,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

],
"sideEffects": false,
"main": "index.js",

@@ -31,7 +32,7 @@ "engines": {

"devDependencies": {
"eslint": "^6.8.0",
"eslint": "^8.56.0",
"fill-range": "^7.0.1",
"gulp-format-md": "^2.0.0",
"mocha": "^6.2.2",
"nyc": "^15.0.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"time-require": "github:jonschlinkert/time-require"

@@ -38,0 +39,0 @@ },

@@ -110,3 +110,3 @@ <h1 align="center">Picomatch</h1>

### [picomatch](lib/picomatch.js#L32)
### [picomatch](lib/picomatch.js#L31)

@@ -123,4 +123,2 @@ Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.

By default, `picomatch` uses [`os.platform()`](https://nodejs.org/api/os.html#osplatform) to detect the operating system.
```js

@@ -152,3 +150,3 @@ const picomatch = require('picomatch');

### [.test](lib/picomatch.js#L117)
### [.test](lib/picomatch.js#L116)

@@ -173,3 +171,3 @@ Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.

### [.matchBase](lib/picomatch.js#L161)
### [.matchBase](lib/picomatch.js#L160)

@@ -192,3 +190,3 @@ Match the basename of a filepath.

### [.isMatch](lib/picomatch.js#L183)
### [.isMatch](lib/picomatch.js#L182)

@@ -214,3 +212,3 @@ Returns true if **any** of the given glob `patterns` match the specified `string`.

### [.parse](lib/picomatch.js#L199)
### [.parse](lib/picomatch.js#L198)

@@ -232,3 +230,3 @@ Parse a glob pattern to create the source string for a regular expression.

### [.scan](lib/picomatch.js#L231)
### [.scan](lib/picomatch.js#L230)

@@ -264,3 +262,3 @@ Scan a glob pattern to separate the pattern into segments.

### [.compileRe](lib/picomatch.js#L245)
### [.compileRe](lib/picomatch.js#L244)

@@ -278,3 +276,3 @@ Compile a regular expression from the `state` object returned by the

### [.makeRe](lib/picomatch.js#L286)
### [.makeRe](lib/picomatch.js#L285)

@@ -302,3 +300,3 @@ Create a regular expression from a parsed glob pattern.

### [.toRegex](lib/picomatch.js#L321)
### [.toRegex](lib/picomatch.js#L320)

@@ -371,6 +369,4 @@ Create a regular expression from the given regex source string.

| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. |
| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. |
picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error.
### Scan Options

@@ -647,26 +643,40 @@

_(Pay special attention to the last three benchmarks. Minimatch freezes on long ranges.)_
```
# .makeRe star
picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled)
minimatch x 627,206 ops/sec ±1.96% (87 runs sampled))
# .makeRe star (*)
picomatch x 4,449,159 ops/sec ±0.24% (97 runs sampled)
minimatch x 632,772 ops/sec ±0.14% (98 runs sampled)
# .makeRe star; dot=true
picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled)
minimatch x 525,876 ops/sec ±0.60% (88 runs sampled)
# .makeRe star; dot=true (*)
picomatch x 3,500,079 ops/sec ±0.26% (99 runs sampled)
minimatch x 564,916 ops/sec ±0.23% (96 runs sampled)
# .makeRe globstar
picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled)
minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d)
# .makeRe globstar (**)
picomatch x 3,261,000 ops/sec ±0.27% (98 runs sampled)
minimatch x 1,664,766 ops/sec ±0.20% (100 runs sampled)
# .makeRe globstars
picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled)
minimatch x 477,179 ops/sec ±1.33% (91 runs sampled)
# .makeRe globstars (**/**/**)
picomatch x 3,284,469 ops/sec ±0.18% (97 runs sampled)
minimatch x 1,435,880 ops/sec ±0.34% (95 runs sampled)
# .makeRe with leading star
picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled)
minimatch x 453,564 ops/sec ±1.43% (94 runs sampled)
# .makeRe with leading star (*.txt)
picomatch x 3,100,197 ops/sec ±0.35% (99 runs sampled)
minimatch x 428,347 ops/sec ±0.42% (94 runs sampled)
# .makeRe - basic braces
picomatch x 392,067 ops/sec ±0.70% (90 runs sampled)
minimatch x 99,532 ops/sec ±2.03% (87 runs sampled))
# .makeRe - basic braces ({a,b,c}*.txt)
picomatch x 443,578 ops/sec ±1.33% (89 runs sampled)
minimatch x 107,143 ops/sec ±0.35% (94 runs sampled)
# .makeRe - short ranges ({a..z}*.txt)
picomatch x 415,484 ops/sec ±0.76% (96 runs sampled)
minimatch x 14,299 ops/sec ±0.26% (96 runs sampled)
# .makeRe - medium ranges ({1..100000}*.txt)
picomatch x 395,020 ops/sec ±0.87% (89 runs sampled)
minimatch x 2 ops/sec ±4.59% (10 runs sampled)
# .makeRe - long ranges ({1..10000000}*.txt)
picomatch x 400,036 ops/sec ±0.83% (90 runs sampled)
minimatch (FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory)
```

@@ -673,0 +683,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc