Tweakr
    Preparing search index...

    Function merge

    • Shallowly merges two objects into a new object.

      Type Parameters

      • T extends object
      • U extends object

      Parameters

      • a: T

        The first object.

      • b: U

        The second object.

      Returns T & U

      A new object containing all keys from a and b.

      const obj1 = { a: 1, b: 2 };
      const obj2 = { b: 3, c: 4 };
      const merged = merge(obj1, obj2);
      console.log(merged); // { a: 1, b: 3, c: 4 }

      1.1.0