mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Having a cleaner syntax a prefer using map() instead of forEach()
This commit is contained in:
@@ -12,12 +12,9 @@ export default class extends ApplicationController {
|
||||
|
||||
// private
|
||||
getOrdersIds() {
|
||||
const order_ids = [];
|
||||
document
|
||||
.querySelectorAll("#listing_orders input[name='order_ids[]']:checked")
|
||||
.forEach((checkbox) => {
|
||||
order_ids.push(checkbox.value);
|
||||
});
|
||||
return order_ids;
|
||||
const checkboxes = document.querySelectorAll(
|
||||
"#listing_orders input[name='order_ids[]']:checked"
|
||||
);
|
||||
return Array.from(checkboxes).map((checkbox) => checkbox.value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user