Socket
Socket
Sign inDemoInstall

rfolder

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rfolder

引入指定文件夹中的所有js文件


Version published
Maintainers
1
Created

Readme

Source

rfolder

引入指定文件夹中的所有js文件

安装

npm install rfolder

使用方法

若文件目录如下:

/dir
/dir/a.js
/dir/b.js
/dir/c/a.js
/dir/c/b.js
方法一

创建文件/dir/index.js并写入如下内容

module.exports = require("rfolder")(__dirname);

通过以下方法引入

const methods = require("/dir");
方法二
const path = reuqire("path");
const methods = require("rfolder")(path.resolve("/dir"));
最后
console.log(methods.a);
console.log(methods.b);
console.log(methods.c.a);
console.log(methods.c.b);

Keywords

FAQs

Last updated on 06 Jan 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