toggle<T>( list: readonly T[], items: T | readonly T[], toKey?: null | (item: T, idx: number) => string | number | symbol, options?: { strategy?: "prepend" | "append" },): T[] Parameters
- list: readonly T[]
- items: T | readonly T[]
Optional
toKey: null | (item: T, idx: number) => string | number | symbolOptional
options: { strategy?: "prepend" | "append" }
Returns T[]
Deprecated
use xor instead
Description
If the item matching the condition already exists in the list it will be removed. If it does not it will be added.
Example