UNPKG

344 BJavaScriptView Raw
1// Determine if the toggle button value matches, or is contained in, the
2// candidate group value.
3export default function isValueSelected(value, candidate) {
4 if (candidate === undefined || value === undefined) {
5 return false;
6 }
7 if (Array.isArray(candidate)) {
8 return candidate.includes(value);
9 }
10 return value === candidate;
11}
\No newline at end of file