Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rrdir

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rrdir - npm Package Compare versions

Comparing version 11.0.0 to 11.0.1

23

index.js

@@ -33,11 +33,9 @@ import {readdir, stat, lstat} from "node:fs/promises";

export function pathGlobToRegex(glob, {flags = undefined, sep = "/"} = {flags: undefined, sep: "/"}) {
if (sep === "\\") sep = "\\\\";
export function pathGlobToRegex(glob, {flags = undefined} = {flags: undefined}) {
return new RegExp(`${glob
.replace(/[|\\{}()[\]^$+.-]/g, "\\$&")
.replace(new RegExp(`\\*\\*${sep}\\*`, "g"), ".*")
.replace(/^\*\*/g, ".*")
.replace(new RegExp(`${sep}?\\*\\*$`, "g"), ".*")
.replace(new RegExp(`(${sep})\\*\\*(${sep})`, "g"), (_, p1, p2) => `${p1}.*${p2}`)
.replace(/([^.])\*/g, (_, p1) => `${p1}[^${sep}]*`)
.replace(/\*\*\/\*/, ".*")
.replace(/\*\*/g, ".*")
.replace(/\//g, "[/\\\\]")
.replace(/([^.])\*/g, (_, p1) => `${p1}[^/\\\\]*`)
.replaceAll("**", "*")

@@ -49,3 +47,3 @@ .replaceAll("?", ".")

function makeMatcher(filters, flags) {
const regexes = filters.map(filter => pathGlobToRegex(filter, {flags, sep}));
const regexes = filters.map(filter => pathGlobToRegex(filter, {flags}));
return str => {

@@ -89,3 +87,4 @@ for (const regex of regexes) {

const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();
const isIncluded = !includeMatcher || includeMatcher(encoding === "buffer" ? String(path) : path);
const encodedPath = encoding === "buffer" ? String(path) : path;
const isIncluded = !includeMatcher || includeMatcher(encodedPath);
let stats;

@@ -141,3 +140,4 @@

const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();
const isIncluded = !includeMatcher || includeMatcher(encoding === "buffer" ? String(path) : path);
const encodedPath = encoding === "buffer" ? String(path) : path;
const isIncluded = !includeMatcher || includeMatcher(encodedPath);
let stats;

@@ -195,3 +195,4 @@

const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();
const isIncluded = !includeMatcher || includeMatcher(encoding === "buffer" ? String(path) : path);
const encodedPath = encoding === "buffer" ? String(path) : path;
const isIncluded = !includeMatcher || includeMatcher(encodedPath);
let stats;

@@ -198,0 +199,0 @@

{
"name": "rrdir",
"version": "11.0.0",
"version": "11.0.1",
"description": "Recursive directory reader with a delightful API",

@@ -18,6 +18,6 @@ "author": "silverwind <me@silverwind.io>",

"devDependencies": {
"eslint": "8.38.0",
"eslint-config-silverwind": "65.1.5",
"updates": "13.4.0",
"versions": "10.4.3",
"eslint": "8.39.0",
"eslint-config-silverwind": "67.0.1",
"updates": "14.1.0",
"versions": "11.0.0",
"vitest": "0.30.1"

@@ -24,0 +24,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