| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A rewritten version of @wilsonlewis' require-context package that utilizes modern technologies.
This module is not a drop in replacement for require-context.
npm install --save async-require-contextimport asyncRequireContext from "async-require-context";asyncRequireContext(path, recursive, pattern);
// In TypeScript, you can specify the type that each module is expected to be.
// asyncRequireContext<Type>(path, recursive, pattern);| Name | Type | Default | Description |
|---|---|---|---|
| path | String | none (required) | Specifies the path to look for modules in. |
| recursive | Boolean | true | If true, will recurse through subdirectorys in path. |
| pattern | RegExp | /\.js$/ | Specifies a filter that files must match. |
asyncRequireContext will always return Promise<Context[]>, if your using type annotations, it will be Promise<Context<Type>[]>
The Context structure is:
{
name: string, // Name of the module.
path: string, // Full path of the module.
module: require(path) // The module as if it was required with `require`. This may be any shape depending on if you use type annotations.
}| Back | FazBrowse Home | New Git URL |