Socket
Socket
Sign inDemoInstall

escalade

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    escalade

Scale parent directories


Version published
Weekly downloads
39M
decreased by-7.93%
Maintainers
1
Install size
2.65 kB
Created
Weekly downloads
 

Package description

What is escalade?

The escalade npm package is a utility designed to simplify the process of ascending file system directories and performing actions based on the presence of specific files or directories. It is particularly useful for tasks such as configuration file discovery, project root identification, and more, by moving up from a given directory until a specified condition is met.

What are escalade's main functionalities?

Finding a specific file in parent directories

This feature allows you to start from a specific directory and move up the directory tree until a file named 'target-file.txt' is found. Once found, you can return a specific path or action based on the discovery.

const escalade = require('escalade');

escalade('/start/path', (dir, names) => {
  if (names.includes('target-file.txt')) {
    return 'path/to/return';
  }
});

Custom condition for directory traversal

This demonstrates how escalade can be used to ascend directories based on a custom condition, such as finding a configuration file with a specific extension. This is useful for dynamically locating project or application configuration files.

const escalade = require('escalade');

escalade('/start/path', (dir, names) => {
  if (names.some(name => name.endsWith('.config.js'))) {
    return 'path/to/specific/config';
  }
});

Other packages similar to escalade

FAQs

Last updated on 19 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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