Adds a key value pair to the given objects and returns a shallow copy. If the key is already present it will be overwritten.

Since v3.12.1. Will not be replaced.

  • Type Parameters

    • T

    Parameters

    • key: string

      Key to be added.

    • value: any

      Value to be added.

    • obj: T

      Object the key value pair is added to.

    Returns T & {
        [key: string]: any;
    }

    The object with the key value pair added.

    Copyright Ⓒ 2024 SAP SE or an SAP affiliate company. All rights reserved.