@vgerbot/async
    Preparing search index...

    Function reject

    • Filters out items for which the async predicate returns true.

      Type Parameters

      • I

        Item/value type in the collection.

      Parameters

      • data: I[] | Promise<I[]>

        Input array/object, or a promise that resolves to one.

      • predicate: (item: I, token: CancellableToken) => Promise<boolean>

        Async predicate used to remove matching items.

      • Optionaloptions: RejectOptions<I>

        Configuration options, including cancellation and concurrency.

      Returns CancellableHandle<I[]>

      A cancellable handle resolving to kept values.

      const handle = reject(
      [1, 2, 3, 4],
      async (item) => item % 2 === 0,
      { concurrency: 2 },
      );

      const result = await handle; // [1, 3]
      const handle = reject(
      { a: 1, b: 2, c: 3 },
      async (value, key) => key === "b" || value < 2,
      );

      const result = await handle; // [3]
    • Filters out items for which the async predicate returns true.

      Type Parameters

      • I

        Item/value type in the collection.

      Parameters

      • data: CollectionInput<I> | Promise<CollectionInput<I>>

        Input array/object, or a promise that resolves to one.

      • predicate: (item: I, key: string | number, token: CancellableToken) => Promise<boolean>

        Async predicate used to remove matching items.

      • Optionaloptions: RejectOptions<I>

        Configuration options, including cancellation and concurrency.

      Returns CancellableHandle<I[]>

      A cancellable handle resolving to kept values.

      const handle = reject(
      [1, 2, 3, 4],
      async (item) => item % 2 === 0,
      { concurrency: 2 },
      );

      const result = await handle; // [1, 3]
      const handle = reject(
      { a: 1, b: 2, c: 3 },
      async (value, key) => key === "b" || value < 2,
      );

      const result = await handle; // [3]