Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Callable

  • ParallelFunction(...args: any[]): Promise<any>
  • Invokes the specified functions in parallel, handling any returned Promises correctly.

    example
    const isValidUserName = functions.parallel(isNonEmpty, allCharactersValid);

    // add more functions to the collection:
    isValidUserName.add(isNotTaken, passesProfanityFilter);

    export async function validate(username) {
    try {
    const results = await isValidUserName(username);
    return result.every(Boolean);
    } catch (e) {
    return false;
    }
    }

    Parameters

    • Rest ...args: any[]

      The arguments to pass to the original functions.

    Returns Promise<any>

    A Promise resolved with the array of settled return values or else rejecting with the first rejection reason or thrown error.

Index

Methods

  • Adds one or more functions to the underlying Set and returns the original grouped function for chaining.

    Parameters

    • Rest ...fns: Function[]

      One or more functions to add to the underlying collection.

    Returns ParallelFunction

    The original grouped function instance.

  • Creates and returns a new copy of the grouped function. Methods can be added or removed from this function without modifying the original.

    Returns ParallelFunction

    A new copy of the original grouped function that can be modified without affecting the original.

  • Adds one or more functions to the underlying Set, starting at the given index, and returns the original grouped function for chaining.

    Parameters

    • index: number

      The position at which to begin inserting functions.

    • Rest ...fns: Function[]

      One or more functions to insert into the underlying Set.

    Returns ParallelFunction

    The original grouped function instance.

  • Removes one or more functions from the underlying Set and returns the original grouped function for chaining.

    Parameters

    • Rest ...fns: Function[]

      One or more functions to remove from the underlying Set.

    Returns ParallelFunction

    The original grouped function instance.