• A recursive assignment of of properties from sources into target. The recursive means that object properties will be merged and not replaced.

    Type Parameters

    • T extends {}

    Parameters

    • target: T

      Object to which the properties are assigned.

    • ...sources: Record<string, any>[]

      Objects from where the properties are read.

    Returns Record<string, any>

    the target

    import assignRecursiveWithPrototype from "apprt-core/assignRecursiveWithPrototype";
    const a: any = { x: 1, z: { a: 1 } };
    const b = { x: 2, z: { b: 1 } };
    const a1 = assignRecursiveWithPrototype(a, b);
    a1 === a; // -> true
    // a1 is {x:2, z: { a: 1, b: 1 }}