debian-mirror-gitlab/spec/frontend/issuable/helpers.js
2023-04-23 21:23:45 +05:30

18 lines
500 B
JavaScript

export function getSaveableFormChildren(form, exclude = ['input.js-toggle-draft']) {
const children = Array.from(form.children);
const saveable = children.filter((e) => {
const isFiltered = exclude.reduce(
({ isFiltered: filtered, element }, selector) => {
return {
isFiltered: filtered || element.matches(selector),
element,
};
},
{ isFiltered: false, element: e },
);
return !isFiltered.isFiltered;
});
return saveable;
}