Function set

  • Sets the value at the specified path of the object. If the path does not exist, it is created. Prevents prototype pollution by checking key safety.

    Parameters

    • obj: Record<string, any>

      The object to modify.

    • path: string

      The path of the property to set, represented as a dot-separated string.

    • value: any

      The value to set at the specified path.

    Returns void