Toggles presence of element in array

  • Type Parameters

    • T

    Parameters

    • x: T

      Element to toggle

    • xs: T[]

      Source array

    Returns T[]

    New array with element added or removed