Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arstgit/require-dir-lite
A helper to require() one directory recursively with no configuration params.
https://github.com/arstgit/require-dir-lite
directory require
Last synced: about 10 hours ago
JSON representation
A helper to require() one directory recursively with no configuration params.
- Host: GitHub
- URL: https://github.com/arstgit/require-dir-lite
- Owner: arstgit
- License: mit
- Created: 2018-06-14T16:59:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-03T06:37:39.000Z (over 6 years ago)
- Last Synced: 2024-10-13T16:11:43.261Z (about 1 month ago)
- Topics: directory, require
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Require-dir-lite
[![Build Status](https://travis-ci.org/derekchuank/require-dir-lite.svg?branch=master)](https://travis-ci.org/derekchuank/require-dir-lite)
[![npm version](https://badge.fury.io/js/require-dir-lite.svg)](http://badge.fury.io/js/require-dir-lite)## Super simple to use
A helper to `require()` one directory recursively with no configuration params.
## Installation
```
npm install require-dir-lite
```## Usage
There is only one param(default: `'.'`) you would concern: the directory path.
```js
let requireDir = require("require-dir-lite");
let dir = requireDir("./somewhere");
```Given this directory structure:
```
dir
+ a.js
+ b.json
+ c
+c-1.js
+.dumb.js
+ d.txt
````requireDir('./dir')` will return the equivalent of:
```js
{
a: require('./dir/a.js'),
b: require('./dir/b.json'),
c: {
c-1: require('./dir/c/c-1.js')
}
}
```