• applies the function mapping_funcs[K] to input input_data[K], for every key K in mapping_funcs
    see RecordMapper to get an understanding of what mapping_funcs is supposed to look like, and how to type it.
    moreover, the 3 generic parameters (R, U, D) used here are the same as the ones at RecordMapper, so check it out.

    Type Parameters

    • R
    • U extends {
          [K in string | number | symbol]: any
      } = {
          [K in string | number | symbol]: unknown
      }
    • D extends unknown = unknown
    • F extends RecordMapper<R, U, D> = RecordMapper<R, U, D>

    Parameters

    • mapping_funcs: F
    • input_data: R

    Returns {
        [K in string | number | symbol]: ReturnType<F[K]>
    }

    Example

    const now_i_know_my = { a: 1, b: 2, c: 3, s: "nein" }
    const now_i_know_my_greek = recordMap({
    a: (v) => `${v}-alpha`,
    b: (v) => `${v}-beta`,
    c: (v) => `${v}-theta`,
    s: (v) => 9
    }, now_i_know_my)
    // assert typeof now_i_know_my_greek extends { a: string, b: string, c: string, s: number }
    console.debug(now_i_know_my_greek) // { a: "1-alpha", b: "2-beta", c: "theta", s: 9 }

Generated using TypeDoc