Commit 85e2b184 authored by minghuan lei's avatar minghuan lei Committed by Martin Wortschack

Resolve "Remove IIFEs from new_branch_form.js"

parent 7f4453f1
...@@ -72,16 +72,14 @@ export default class NewBranchForm { ...@@ -72,16 +72,14 @@ export default class NewBranchForm {
}); });
return `${restriction.prefix} ${formatted.join(restriction.conjunction)}`; return `${restriction.prefix} ${formatted.join(restriction.conjunction)}`;
}; };
const validator = (function(_this) { const validator = (errors, restriction) => {
return function(errors, restriction) { const matched = this.name.val().match(restriction.pattern);
const matched = _this.name.val().match(restriction.pattern);
if (matched) { if (matched) {
return errors.concat(formatter(matched.reduce(unique, []), restriction)); return errors.concat(formatter(matched.reduce(unique, []), restriction));
} else { } else {
return errors; return errors;
} }
}; };
})(this);
const errors = this.restrictions.reduce(validator, []); const errors = this.restrictions.reduce(validator, []);
if (errors.length > 0) { if (errors.length > 0) {
const errorMessage = $('<span/>').text(errors.join(', ')); const errorMessage = $('<span/>').text(errors.join(', '));
......
---
title: Remove IIFEs from new_branch_form.js
merge_request: 20009
author: minghuan lei
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment