UNPKG

350 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
8 if (Array.isArray(candidate)) {
9 return candidate.indexOf(value) >= 0;
10 }
11
12 return value === candidate;
13}
\No newline at end of file