• Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it

    Type Parameters

    • T
    • K extends string | number | symbol

    Parameters

    • target: T

      The target object to return or set the default value

    • field: K

      The key for the field to set on the target

    • OptionaldefValue: T[K]

      [Optional] The value to set if not already present, when not provided a empty object will be added

    Returns T[K]