Function setObjectProperty

  • Set a property on the specified object at the specified path. Modifies the original object, when a part of the specified path is not set an empty object is created

    Type Parameters

    • T extends object

    Parameters

    • obj: T

      Object to set the property on

    • prop: string

      Property path to set

    • value: any

      Value to set at the specified path

    • Optional options: {
          create?: boolean;
      }
      • Optional create?: boolean

        Create an object to be able to set the specified property, otherwise does not set the property specified

    Returns T

    The original obj with the property path set to the specified value;