function getFilterItemValue(filterList) {
const filterListInputs = Array.from(filterList)
const checkedGroup = []
filterListInputs
.filter((checkbox) => checkbox.checked)
.map((checkbox) => {
if (checkedGroup.indexOf(checkbox.name) === -1) {
checkedGroup[checkbox.name] = []
}
return checkedGroup[checkbox.name].push(checkbox.value);
})
return checkedGroup
}
const getCheckedValues = elements =>
[...elements].reduce((acc, n) => (
n.checked && (acc[n.name] = acc[n.name] || []).push(n.value),
acc
), {});
const getCheckedValues = elements =>
Array.prototype.reduce.call(
elements,
(acc, { name, value, checked }) => (
acc[name] = acc[name] || [],
checked && acc[name].push(value),
acc
),
{}
);