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

escalade

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escalade

A tiny (186B to 214B) and fast utility to ascend parent directories

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50M
decreased by-6.73%
Maintainers
1
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 19 Jun 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc