Skip to content

asyncFilterInPlace<T>

Filters an array asynchronously in place, keeping only the elements that satisfy the provided predicate function.

Import:

import { asyncFilterInPlace } from 'obsidian-dev-utils/async';

Signature:

function asyncFilterInPlace(arr: T[], predicate: (value: T, index: number, array: T[]) => Promisable<boolean>): Promise<void>

Parameters:

ParameterTypeDescription
arrT[]The array to filter.
predicate(value: T, index: number, array: T[]) => Promisable<boolean>The predicate function to test each element.

Returns: Promise<void> — A Promise that resolves when the array is filtered.