Function mapKeys

  • Transform the keys of the input object using the mapper and return the mapped object. The returned object will be the same as the input if inPlace is truthy.

    Parameters

    • object: any
    • mapper: ICallable
    • Optional inPlace: boolean

    Returns any

    Example

    import { mapKeys } from 'apption'
    const obj = mapKeys({ a: 1, b: 2, c: 3 }, (k, v) => `${k}1`);
    console.log(obj) // { a1: 1, b1: 2, c1: 3 }