Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/not-an-aardvark/entire-folder
Allow CommonJS require() to work with folder names
https://github.com/not-an-aardvark/entire-folder
Last synced: about 1 month ago
JSON representation
Allow CommonJS require() to work with folder names
- Host: GitHub
- URL: https://github.com/not-an-aardvark/entire-folder
- Owner: not-an-aardvark
- License: mit
- Created: 2016-03-28T06:52:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-28T09:02:25.000Z (almost 9 years ago)
- Last Synced: 2024-10-15T21:48:56.952Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# entire-folder [![Build Status](https://travis-ci.org/not-an-aardvark/entire-folder.svg?branch=master)](https://travis-ci.org/not-an-aardvark/entire-folder)
Allows you to `require()` all of the modules in a folder.
```bash
npm install entire-folder
```## Usage
Suppose there is a folder called `myFolder/` in the current directory. It contains the files `file1.js`, `file2.js`, and `file3.js`.
```js
var folder = require('entire-folder')('myFolder');
console.log(folder);
/* => {
file1: "file1's exports would be here",
file2: "file2's exports would be here",
file3: "file3's exports would be here"
} */
```