- toggle<T>(list, items, toKey?, options?): T[]
Parameters
- list: readonly T[]
- items: T | readonly T[]
Optional
toKey: null | ((item: T, idx: number) => string | number | symbol)Optional
options: {
strategy?: "prepend" | "append";
}Optional
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