Function mapObjectByObject

  • Maps the contents of data using mapper as a structured set of map functions.

    const a = {
    person: {
    size: 20
    }
    hello: `there`
    }
    mapObjectByObject(a, {
    person: {
    size: (value, context) => {
    return value * 2
    }
    }
    });
    // Yields: { person: { size: 40 }, hello: `there` }

    Parameters

    • data: any
    • mapper: Record<string, ((value: any, context: any) => any)>

    Returns {
        [k: string]: T;
    }

    • [k: string]: T