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

print-project

Package Overview
Dependencies
Maintainers
0
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

print-project - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

14

dist/index.js

@@ -53,4 +53,7 @@ #!/usr/bin/env node

return patterns.some(pattern => {
const parsedPattern = pattern.replace(/\./g, "\\.").replace(/\*/g, ".*");
const regex = new RegExp(parsedPattern);
const escapedPattern = pattern
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
.replace(/\*/g, '.*')
.replace(/\?/g, '.');
const regex = new RegExp(`^${escapedPattern}$|/${escapedPattern}$|/${escapedPattern}/|^${escapedPattern}/`);
return regex.test(filePath);

@@ -60,3 +63,8 @@ });

function shouldIncludeFile(filePath, ignorePatterns, includePatterns) {
return !matchesPattern(filePath, ignorePatterns) || matchesPattern(filePath, includePatterns);
const isIgnored = matchesPattern(filePath, ignorePatterns);
const isIncluded = includePatterns.length === 0 || matchesPattern(filePath, includePatterns);
if (includePatterns.length > 0) {
return isIncluded;
}
return !isIgnored;
}

@@ -63,0 +71,0 @@ function readDirectory(dirPath, ignorePatterns, includePatterns, treeStructure = {}, currentPath = "") {

{
"name": "print-project",
"version": "1.0.10",
"version": "1.0.11",
"description": "A simple CLI tool to print the project tree structure and file contents",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -34,4 +34,7 @@ #!/usr/bin/env node

return patterns.some(pattern => {
const parsedPattern = pattern.replace(/\./g, "\\.").replace(/\*/g, ".*");
const regex = new RegExp(parsedPattern);
const escapedPattern = pattern
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
.replace(/\*/g, '.*')
.replace(/\?/g, '.');
const regex = new RegExp(`^${escapedPattern}$|/${escapedPattern}$|/${escapedPattern}/|^${escapedPattern}/`);
return regex.test(filePath);

@@ -42,3 +45,8 @@ });

function shouldIncludeFile(filePath: string, ignorePatterns: string[], includePatterns: string[]): boolean {
return !matchesPattern(filePath, ignorePatterns) || matchesPattern(filePath, includePatterns);
const isIgnored = matchesPattern(filePath, ignorePatterns);
const isIncluded = includePatterns.length === 0 || matchesPattern(filePath, includePatterns);
if (includePatterns.length > 0) {
return isIncluded;
}
return !isIgnored;
}

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