@luolapeikko/ts-common
    Preparing search index...

    Function asyncFilter

    • Async filter version of Array.prototype.filter(), with the same signature as its synchronous counterpart.

      Type Parameters

      • T

        The type of the array

      Parameters

      • list: Loadable<Iterable<T, any, any>>

        The iterable to filter

      • asyncPredicate: (item: T, index: number, array: T[]) => boolean | Promise<boolean>

        The predicate function

      Returns Promise<T[]>

      A promise that resolves to the filtered array

      asyncFilter([1, 2, 3], (item) => Promise.resolve(item % 2 === 0)); // [2]
      

      v0.3.7