@olchyk98/walker

1.0.2 • Public • Published

Walker

My way of creating scalable programs

Table of Contents

  1. Installation
  2. Usage

Installation

Install the package with Yarn:

yarn add @olchyk98/walker

Or with NPM:

npm i @olchyk98/walker

Usage

The idea is to go through all modules in the project, and import them. By passing a matches array as an argument, you specifically can decide what files should be imported.

import walkFiles from '@olchyk98/walker'

async function loadHandlers () {
  const handlers = await walkFiles('.',  [ '-handler.js' ])
  console.log(handlers[0]) // .../my-project/src/handlers/my-handler.js
}

The function may also return an array of imported modules if argument doRequire is set to true:

const handlers = await walkFiles('.', [ '-handler.js' ], true)
console.log(handlers[0]) // {}

Readme

Keywords

none

Package Sidebar

Install

npm i @olchyk98/walker

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

292 kB

Total Files

9

Last publish

Collaborators

  • olchyk98