@types/require-directory

  • Version 2.1.6
  • Published
  • 5.3 kB
  • 1 dependency
  • MIT license

Install

npm i @types/require-directory
yarn add @types/require-directory
pnpm add @types/require-directory

Overview

TypeScript definitions for require-directory

Index

Variables

variable defaults

const defaults: RequireDirectoryOptions<any, any>;
  • default options that is used for "require-directory" module

Functions

function requireDirectory

requireDirectory: typeof requireDirectory;
  • function for requiring directory content as hash of modules

    Parameter m

    module for which has will be created

    Parameter path

    path to directory, if you want to build hash for another one (default to __dirname)

    Parameter options

    object with options for require-directory call

    Returns

    hash of modules in specified directory

Interfaces

interface RequireDirectoryOptions

interface RequireDirectoryOptions<T, U = T> {}

    property exclude

    exclude?: RegExp | CheckPathFn | undefined;
    • RegExp or function for blacklisting modules undefined

    property extensions

    extensions?: string[] | undefined;
    • array of file extensions that will be included in resulting hash as modules "['js', 'json', 'coffee']"

    property include

    include?: RegExp | CheckPathFn | undefined;
    • RegExp or function for whitelisting modules undefined

    property recurse

    recurse?: boolean | undefined;
    • option to include subdirectories true

    method rename

    rename: (name: string) => string;
    • function for renaming modules in resulting hash

      Parameter name

      name of required module

      Returns

      transformed name of module "change nothing"

    method visit

    visit: (obj: T) => U | void;
    • function that will be called for each required module

      Parameter obj

      required module

      Returns

      transformed module OR nothing (in second case module itself will be added to hash) "change nothing"

    interface RequireDirectoryResult

    interface RequireDirectoryResult<T> {}

      index signature

      [index: string]: RequireDirectoryResult<T> | T;
      • module itself or hash of modules in subdirectory with name of this directory

      Type Aliases

      type CheckPathFn

      type CheckPathFn = (path: string) => boolean;
      • function that checks path for whitelisting/blacklisting

        Parameter path

        path of required module

        Returns

        true if path have to be whitelisted/blacklisted, false otherwise

      Package Files (1)

      Dependencies (1)

      Dev Dependencies (0)

      No dev dependencies.

      Peer Dependencies (0)

      No peer dependencies.

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/require-directory.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/require-directory)
      • HTML
        <a href="https://www.jsdocs.io/package/@types/require-directory"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>