Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 6 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 50% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 2 | const DEFAULT_TIMEOUT_DELAY = 2000; |
|
2 | |||
3 | 2 | export const stateFlagTimeout = (setState, flagName, initialValue = true, delay = DEFAULT_TIMEOUT_DELAY) => { |
|
4 | setState({ [flagName]: initialValue }); |
||
5 | setTimeout(() => setState({ [flagName]: !initialValue }), delay); |
||
6 | }; |
||
7 |