Function map

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: T[]

      the collection to be mapped

    • fn: ((value: T, index: number) => Result)

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, index: number): Result
        • Parameters

          • value: T
          • index: number

          Returns Result

    Returns Result[]

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Nullable<T[]>

      the collection to be mapped

    • fn: ((value: T, index: number) => Result)

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, index: number): Result
        • Parameters

          • value: T
          • index: number

          Returns Result

    Returns Nullable<Result[]>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Undefinable<T[]>

      the collection to be mapped

    • fn: ((value: T, index: number) => Result)

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, index: number): Result
        • Parameters

          • value: T
          • index: number

          Returns Result

    Returns Undefinable<Result[]>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Optional<T[]>

      the collection to be mapped

    • fn: ((value: T, index: number) => Result)

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, index: number): Result
        • Parameters

          • value: T
          • index: number

          Returns Result

    Returns Optional<Result[]>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Dictionary<T>

      the collection to be mapped

    • fn: ((value: T, key: string) => {
          key: string;
          value: Result;
      })

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, key: string): {
              key: string;
              value: Result;
          }
        • Parameters

          • value: T
          • key: string

          Returns {
              key: string;
              value: Result;
          }

          • key: string
          • value: Result

    Returns Dictionary<Result>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Nullable<Dictionary<T>>

      the collection to be mapped

    • fn: ((value: T, key: string) => {
          key: string;
          value: Result;
      })

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, key: string): {
              key: string;
              value: Result;
          }
        • Parameters

          • value: T
          • key: string

          Returns {
              key: string;
              value: Result;
          }

          • key: string
          • value: Result

    Returns Nullable<Dictionary<Result>>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Undefinable<Dictionary<T>>

      the collection to be mapped

    • fn: ((value: T, key: string) => {
          key: string;
          value: Result;
      })

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, key: string): {
              key: string;
              value: Result;
          }
        • Parameters

          • value: T
          • key: string

          Returns {
              key: string;
              value: Result;
          }

          • key: string
          • value: Result

    Returns Undefinable<Dictionary<Result>>

  • Maps elements from the collection using mapping function. This function will always return the same type of collection. This means that if you pass nullable dictionary, you will also receive nullable dictionary.

    If the collection is null or undefined, the function will immediately return.

    Returns

    the same type of collection with mapped elements.

    Type Parameters

    • T

    • Result

    Parameters

    • collection: Optional<Dictionary<T>>

      the collection to be mapped

    • fn: ((value: T, key: string) => {
          key: string;
          value: Result;
      })

      predicate that receives the value and index (or key) of the collection element. Function can transform this value to some other value. The return type differs depending on the type of collection.

      1. If the collection is array, only the value must be returned
      2. If the value is dictionary, function must return { key: newKey; value: mappedResult }
        • (value: T, key: string): {
              key: string;
              value: Result;
          }
        • Parameters

          • value: T
          • key: string

          Returns {
              key: string;
              value: Result;
          }

          • key: string
          • value: Result

    Returns Optional<Dictionary<Result>>

Generated using TypeDoc