Function createFileExtensionFilter

  • Takes a list of file extensions and returns a filter function that returns true if a filepath/filename passed to it contains one of the given file extensions.

    Parameters

    • fileExtensions: string[]

      file extensions

    Returns ((filepath) => boolean)

    A function that takes a filepath and returns true if the filepath has one of the specified file extensions, false otherwise.

      • (filepath): boolean
      • Parameters

        • filepath: string

        Returns boolean

    Remarks

    If no file extensions are provided, the filter will always return true.

    Example

    createFileExtensionFilter(['.ts', '.tsx'])('index.ts');
    //=> true
    createFileExtensionFilter(['.ts', '.tsx'])('index.js');
    //=> false

Generated using TypeDoc