New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uinz-require-dir

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uinz-require-dir

require dir

1.0.6
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

uinz-require-dir

npm i uinz-require-dir --save

how to use

requireDir(dirPath[, iAmIndex ])

example dir

foo
  |- foo-a.js 
  |- foo-b.js 
  `- bar 
      |- index.js
      |- bar-a.js
      `- bar-b.js
const requireDir = require('uinz-require-dir')
const result = requireDir('./foo')

// result = {
//     fooA: require('./foo/foo-a.js'),   
//     fooB: require('./foo/foo-b.js'),
//     bar: require('./bar/index.js') // due to bar has index.js
// }

if you use it in index.js const result = requireDir('./foo', true)

TODO

不知道怎么处理 requireDir('./') 的使用方式 暂时只能 requireDir(__dirname) 的方式 path 应该怎么用呢?

Keywords

require

FAQs

Package last updated on 11 Jun 2016

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