common-stuff
    Preparing search index...

    Function filter

    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • V

      Parameters

      • input: V[]
      • predicate: (value: V, index: number) => Promise<boolean>

      Returns Promise<V[]>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • V
      • R

      Parameters

      • input: V[]
      • predicate: (value: V, index: number) => value is R

      Returns R[]

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • V

      Parameters

      • input: V[]
      • predicate: (value: V, index: number) => boolean

      Returns V[]

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • K
      • V

      Parameters

      • input: Map<K, V>
      • predicate: (value: [K, V], index: number) => Promise<boolean>

      Returns Promise<Map<K, V>>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • K
      • V

      Parameters

      • input: Map<K, V>
      • predicate: (value: [K, V], index: number) => boolean

      Returns Map<K, V>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T

      Parameters

      • input: Set<T>
      • predicate: (value: T, index: number) => Promise<boolean>

      Returns Promise<Set<T>>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T
      • R

      Parameters

      • input: Set<T>
      • predicate: (value: T, index: number) => value is R

      Returns Set<R>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T

      Parameters

      • input: Set<T>
      • predicate: (value: T, index: number) => boolean

      Returns Set<T>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T

      Parameters

      • input: AsyncIterable<T>
      • predicate: (value: T, index: number) => boolean | Promise<boolean>

      Returns AsyncIterable<T>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T

      Parameters

      • input: Iterable<T>
      • predicate: (value: T, index: number) => Promise<boolean>

      Returns Promise<Iterable<T, any, any>>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • T

      Parameters

      • input: Iterable<T>
      • predicate: (value: T, index: number) => boolean

      Returns Iterable<T>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • K extends PropertyKey
      • V

      Parameters

      • input: Record<K, V>
      • predicate: (value: [K, V], index: number) => Promise<boolean>

      Returns Promise<Record<K, V>>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]
    • Filters an iterable structure preserving the original container type.

      When the predicate returns a Promise, the function returns a Promise of the resulting container.

      Type Parameters

      • K extends PropertyKey
      • V

      Parameters

      • input: Record<K, V>
      • predicate: (value: [K, V], index: number) => boolean

      Returns Record<K, V>

      filter([1, 2, 3, 4], v => v % 2 === 0)            // [2, 4]
      await filter([1, 2, 3], async v => v > 1) // [2, 3]