toggleArrayItemconstant

toggleArrayItem: <T>(items: PossibleArray<T>, toggle: T) => ImmutableArray<T>
Return
unknown
A new array with the item toggled, or the same array if nothing changed.

Toggle an item in and out of an array (immutably) and return a new array with or without the specified item (or the same array if no changes were made).

Examples

toggleArrayItem([1, 2], 2); // [1]