# map-require

> Require a directory of modules and apply a function on module.exports

Latest version **0.0.5** (published 2014-04-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install map-require
pnpm add map-require
yarn add map-require
bun add map-require
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2014-04-03 |
| First published | 2014-03-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Trevor Landau |
| Maintainers | landau |
| Keywords | functional, require, map, iterate, module |

## Links

- npm: https://www.npmjs.com/package/map-require
- Repository: https://github.com/landau/node-map-require
- Issues: https://github.com/landau/node-map-require/issues
- npm.io page: https://npm.io/package/map-require

## Recent versions

- 0.0.5 (latest) — 2014-04-03
- 0.0.4 — 2014-04-03
- 0.0.3 — 2014-03-27
- 0.0.2 — 2014-03-26
- 0.0.1 — 2014-03-26

## README

[![Build Status](https://travis-ci.org/landau/node-map-require.svg)](https://travis-ci.org/landau/node-map-require)

map-require
================

Require a directory of modules and apply a function on module.exports

```js
function mapRequire(dir, fn, ctx) { }
```

## Install

`npm i -S map-require`

## Usage

```js
var path = require('path');
var is = require('is-predicate');
var assert = require('assert');

var mapRequire = require('map-require');
var FIXTURES = path.join(__dirname, 'fixtures');

var arr = mapRequire(FIXTURES, property('name'));
assert(is.array(arr));
assert(arr.indexOf('Charmander') > -1);
assert(arr.indexOf('Pikachu') > -1);

// override regex
var arr = mapRequire(FIXTURES, property('name'), null, /[^pikachu].js$/);
assert.equal(arr.length, 1);
assert(arr.indexOf('Charmander') > -1);
assert.equal(arr.indexOf('Pikachu'), -1);
```

## Changelog

#### 0.0.5
- Added ability to override internal `RegExp` as 4th param

#### 0.0.2 - 0.0.4
- Bug fixes

#### 0.0.1
- Initial releaset

---
_Source: https://npm.io/package/map-require · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
