Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gabrielrufino/folquire

📁 Requires all the modules from a folder
https://github.com/gabrielrufino/folquire

helper modules nodejs npm package

Last synced: 7 days ago
JSON representation

📁 Requires all the modules from a folder

Awesome Lists containing this project

README

        

![Folquire banner](./assets/folquire.png)

# Folquire

Requires all the modules from a folder

### Getting started

To install run this command:

```bash
$ npm install folquire
```

Let's see an example. Suppose we have the following folder structure:

```
+-- math
| +-- add.js
| +-- subtract.js
| +-- multiply.js
| +-- divide.js
+-- index.js
```

index.js

```js
'use strict'

const { join } = require('path')
const folquire = require('folquire')

const math = folquire(join(__dirname, 'math'))

math.add(1, 2) // 2
math.subtract(8, 4) // 4
math.multiply(6, 7) // 42
math.divide(20, 10) // 2
```

### Async folquire

index.js

```js
'use strict'

const { join } = require('path')
const folquire = require('folquire')

folquire(join(__dirname, 'math'))
.then(math => {
math.add(1, 2) // 2
math.subtract(8, 4) // 4
math.multiply(6, 7) // 42
math.divide(20, 10) // 2
})
```

### Ignore modules

```js
'use strict'

const { join } = require('path')
const folquire = require('folquire')

const modules = folquire(join(__dirname, 'math'), {
ignore: ['add.js']
})
```

---

Black Tech by [Gabriel Rufino](https://github.com/gabrielrufino) 🖤