Open
Description
Hi,
I want to propose to add a new function called toggle to underscore.
At simple level it would toggle the value given to it. i.e if it is passed true it will return false and if it is passed false it will return true.
ex-
flag = _.toggle(flag)
// if flag was true then it will get set to false
Also additionally we can have another function that if passed custom arguments then it will return a new function which can be used to toggle with those arguments
For ex -
bitToggler = getTogglingfunction(0,1)
Now if we do
bit = bitToggler (bit)
// If bit had value of 0 it will be set as 1