Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "project/util/projectUtils"

Index

Type aliases

GlobOptions

GlobOptions: string | string[]

Allows conveniently passing one or many glob patterns to utility functions

Functions

deleteFiles

  • Delete files matching the glob pattern and extra test (if supplied)

    Type parameters

    • T

    Parameters

    • project: ProjectAsync

      project to act on

    • globPatterns: GlobOptions

      glob patterns for files to delete

    • Default value test: function = () => true

      additional, optional test for files to be deleted

        • (f: File): boolean
        • Parameters

          Returns boolean

    Returns Promise<number>

doWithFiles

  • doWithFiles<P>(project: P, globPatterns: GlobOptions, op: function): Promise<P>
  • Perform the same operation on all the files.

    Type parameters

    Parameters

    • project: P

      project to act on

    • globPatterns: GlobOptions

      glob patterns to match

    • op: function

      operation to perform on files. Can return void or a promise.

        • (f: File): void | Promise<any>
        • Parameters

          Returns void | Promise<any>

    Returns Promise<P>

fileExists

  • Does at least one file matching the given predicate exist in this project? No guarantees about ordering

    Type parameters

    • T

    Parameters

    Returns Promise<boolean>

saveFromFiles

  • Gather data from a set of files

    Type parameters

    • T

    Parameters

    • project: ProjectAsync

      project to act on

    • globPatterns: GlobOptions

      glob patterns for files to match

    • gather: function

      function that saves a value from a file or discards it by returning undefined

        • (f: File): T | undefined
        • Parameters

          Returns T | undefined

    Returns Promise<T[]>

saveFromFilesAsync

  • Same as saveFromFiles, but works with promise returns

    Type parameters

    • T

    Parameters

    • project: ProjectAsync

      to act on

    • globPatterns: GlobOptions

      glob pattern for files to match

    • gather: function

      function returning a promise from each file

        • (f: File): Promise<T> | undefined
        • Parameters

          Returns Promise<T> | undefined

    Returns Promise<T[]>

toPromise

Generated using TypeDoc