jashkenas / jashkenas/underscore
Add _.toggle/_.transition/_.fsm to underscore
- Dominant language
- JavaScript
- Stars
- 27.3k
- Forks
- 5.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 1
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
Contributor guide
Research direction
Start by reading issue #2850 and the linked pull request #2897 to understand the proposed toggle, transition, and FSM APIs. Check whether the pull request resolves the proposal and what API behavior it defines; done would require an agreed scope and accepted implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100