Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lvegerano/getem
https://github.com/lvegerano/getem
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lvegerano/getem
- Owner: lvegerano
- License: mit
- Created: 2017-08-22T19:31:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-09T16:14:20.000Z (about 7 years ago)
- Last Synced: 2024-10-16T11:32:40.505Z (about 1 month ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# getem
[![Build Status](https://travis-ci.org/lvegerano/getem.svg?branch=master)](https://travis-ci.org/lvegerano/getem)
A module that allows you get all the files withing a directory. Inpired by [node-require-all](https://github.com/felixge/node-require-all) .
## Installation
`npm install getem`
## Usage
```javascript
const directory = `${__dirname}/some/path`; // or an options object
const modules = require('getem')(directory);
```
## Options
Options can be a `string` of the path. Or a configuration object.
| key | default | description |
| --------------- |:------------------------:| --------------------------------------------------------------------------------------------- |
| dirname | `null` | The directory where file are going to be required from |
| recursive | `true` | Whether or not to recurse when encoutering a directory |
| require_indexes | `true` | When `true` if a directory is encountered it will try to require it |
| excludeDir | `/^[^\.]/` | `RegEx` or `Function` - it must return falsy value. By default it will exclude hidden folders |
| filterFile | `/^([^\.].*)\.js(on)?$/` | `RegEx` or `Function` - it must return falsy value. By default it will exclude hidden files |
| map | `(val) => val` | Allows you to modify the name of the key to be inserted as the module refer |### Licence
MIT