Function filterMap

Create a new Map containing all elements from the source map that pass the provided test predicate.

source map

function to test each element of source map

  • Create a new Map containing all elements from the source map that pass the provided test predicate.

    Type Parameters

    • K
    • V
    • S

    Parameters

    • map: ReadonlyMap<K, V>

      source map

    • predicate: ((value: V, key: K) => value is S)

      function to test each element of source map

        • (value, key): value is S
        • Parameters

          • value: V
          • key: K

          Returns value is S

    Returns Map<K, S>

  • Create a new Map containing all elements from the source map that pass the provided test predicate.

    Type Parameters

    • K
    • V

    Parameters

    • map: ReadonlyMap<K, V>

      source map

    • predicate: ((value: V, key: K) => boolean)

      function to test each element of source map

        • (value, key): boolean
        • Parameters

          • value: V
          • key: K

          Returns boolean

    Returns Map<K, V>