Either adds or removes an item from an array, based on whether it
already exists in the array. If multiple items match the given
item, all matching items will be removed.
Note that the given array is not mutated. A copy of the array
is returned with the given item either added or removed.
"toKey" parameter
You may define a toKey callback, which is a function that
converts an item into a value that can be checked for equality.
When called with the given item, an index of -1 will be passed.
"strategy" option
You may define a strategy option, which determines where the
item should be added in the array.
Either adds or removes an item from an array, based on whether it
already exists in the array. If multiple items match the given
item, all matching items will be removed.
Note that the given array is not mutated. A copy of the array
is returned with the given item either added or removed.
"toKey" parameter
You may define a toKey callback, which is a function that
converts an item into a value that can be checked for equality.
When called with the given item, an index of -1 will be passed.
"strategy" option
You may define a strategy option, which determines where the
item should be added in the array.
Either adds or removes an item from an array, based on whether it
already exists in the array. If multiple items match the given
item, all matching items will be removed.
Note that the given array is not mutated. A copy of the array
is returned with the given item either added or removed.
"toKey" parameter
You may define a toKey callback, which is a function that
converts an item into a value that can be checked for equality.
When called with the given item, an index of -1 will be passed.
"strategy" option
You may define a strategy option, which determines where the
item should be added in the array.
Either adds or removes an item from an array, based on whether it
already exists in the array. If multiple items match the given
item, all matching items will be removed.
Note that the given array is not mutated. A copy of the array
is returned with the given item either added or removed.
"toKey" parameter
You may define a toKey callback, which is a function that
converts an item into a value that can be checked for equality.
When called with the given item, an index of -1 will be passed.
"strategy" option
You may define a strategy option, which determines where the
item should be added in the array.
By default, toggle will append the item if it does not exist. If you need to prepend the item instead you can override the strategy in the options argument.
Either adds or removes an item from an array, based on whether it
already exists in the array. If multiple items match the given
item, all matching items will be removed.
Note that the given array is not mutated. A copy of the array
is returned with the given item either added or removed.
"toKey" parameter
You may define a toKey callback, which is a function that
converts an item into a value that can be checked for equality.
When called with the given item, an index of -1 will be passed.
"strategy" option
You may define a strategy option, which determines where the
item should be added in the array.