Function upsert

  • Pushes an item to the array if it doesn't exist, otherwise updates it.

    Type Parameters

    • T

    Parameters

    • array: T[]
    • item: T
    • Optionalpredicate: ((value: T) => boolean)
        • (value): boolean
        • Parameters

          • value: T

          Returns boolean

    Returns void