• Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk function will only be called if the new value is no equal to the original value.

    Type Parameters

    • T
    • K extends string | number | symbol

    Parameters

    • target: T

      The target object

    • field: K

      The key of the target

    • value: T[K]

      The value to set

    • OptionalvalChk: ((value: T[K]) => boolean)

      [Optional] Callback to check the value that if supplied will be called check if the new value can be set

        • (value): boolean
        • Parameters

          • value: T[K]

          Returns boolean

    • OptionalsrcChk: ((value: T[K]) => boolean)

      [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)

        • (value): boolean
        • Parameters

          • value: T[K]

          Returns boolean

    Returns T[K]

    The existing or new value, depending what was set