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

rcfinder

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

rcfinder

Find a config file (like .jshintrc) by walking up from a specific directory.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-78.9%
Maintainers
1
Weekly downloads
 
Created
Source

rcfinder

Travis CI

Find a config file (like .jshintrc) by walking up from a specific directory.

Custom logic can be implemented for loading your config files, and calls to the file system are cached so that you can find files relative to every file in a project without making a ton of unnecessary calls.

install

npm install rcfinder

Use

Create an instance of the RcFinder class, passing it the name of your config file and an object specifying other options.

var RcFinder = require('rcfinder');
var rcFinder = new RcFinder('.jshintrc', {});

Then you can use the finder to look up the proper config file for a directory.

// get the closet .jshintc file for this file
var config = rcFinder.find(__dirname);

If you want to use async file system calls, just specify a callback to find.

rcFinder.find(__dirname, function (err, config) {

});

Config

When creating an instance of the RcFinder class, you can specify options to dictate how the class behaves.

config.loader

A function to call that will load a given path. Once the path for a config file is determined, this will be called with that path as it's only argument and it should return a proper value. Any value other than undefined will be cached.

The default loader is:

function loader(path) {
  return require(path);
}

Keywords

FAQs

Package last updated on 17 Feb 2014

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