Function findAncestor

Find an ancestor file path that matches the given callback. If no matches are found all the way up until the system root, this returns undefined.

undefined if no matches are found.

  • Find an ancestor file path that matches the given callback. If no matches are found all the way up until the system root, this returns undefined.

    Parameters

    • currentPath: string
    • callback: (path: string) => Promise<boolean>

    Returns Promise<undefined | string>

    undefined if no matches are found.

  • Find an ancestor file path that matches the given callback. If no matches are found all the way up until the system root, this returns undefined.

    Parameters

    • currentPath: string
    • callback: (path: string) => boolean

    Returns undefined | string

    undefined if no matches are found.

  • Find an ancestor file path that matches the given callback. If no matches are found all the way up until the system root, this returns undefined.

    Parameters

    • currentPath: string
    • callback: (path: string) => MaybePromise<boolean>

    Returns MaybePromise<undefined | string>

    undefined if no matches are found.