Socket
Socket
Sign inDemoInstall

req-all

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

req-all

Require all files in a directory


Version published
Maintainers
1
Created
Source

req-all Build Status

Require all files in a directory

This module is intentionally simple. Not interested in more features.

Install

$ npm install --save req-all

Usage

.
└── dir
    ├── foo-bar.js
    └── baz-faz.js
const reqAll = require('req-all');
const modules = reqAll('dir');

console.log(modules);
//=> {fooBar: [Function], bazFaz: [Function]}

API

reqAll([directory], [options])

directory

Type: string
Default: __dirname

Directory to require supported files in. Unless you've modified require.extensions, that means any .js, .json, .node files, in that order. Does not recurse. Ignores the caller file and files starting with . or _.

options

Type: Object

camelize

Type: boolean
Default: true

Convert dash-style names (foo-bar) to camel-case (fooBar).

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 13 Jan 2017

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