aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/repo-home.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-03-25 19:37:55 +0100
committerGitHub <noreply@github.com>2024-03-25 18:37:55 +0000
commit8fe26fb314f1710139728d9118b455fc6a16cce2 (patch)
treec6c101f83b74144af61a29b649d63fa7f74b788c /web_src/js/features/repo-home.js
parentf73d891fc4979cbd704d145f7e892f73d0eb5e39 (diff)
downloadgitea-8fe26fb314f1710139728d9118b455fc6a16cce2.tar.gz
gitea-8fe26fb314f1710139728d9118b455fc6a16cce2.zip
Refactor all `.length === 0` patterns in JS (#30045)
This pattern comes of often during review, so let's fix it once and for all. Did not test, but changes are trivial enough imho.
Diffstat (limited to 'web_src/js/features/repo-home.js')
-rw-r--r--web_src/js/features/repo-home.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/web_src/js/features/repo-home.js b/web_src/js/features/repo-home.js
index 2b0e38f087..e195c23c37 100644
--- a/web_src/js/features/repo-home.js
+++ b/web_src/js/features/repo-home.js
@@ -153,11 +153,11 @@ export function initRepoTopicBar() {
$.fn.form.settings.rules.validateTopic = function (_values, regExp) {
const $topics = $topicDropdown.children('a.ui.label');
- const status = $topics.length === 0 || $topics.last()[0].getAttribute('data-value').match(regExp);
+ const status = !$topics.length || $topics.last()[0].getAttribute('data-value').match(regExp);
if (!status) {
$topics.last().removeClass('green').addClass('red');
}
- return status && $topicDropdown.children('a.ui.label.red').length === 0;
+ return status && !$topicDropdown.children('a.ui.label.red').length;
};
$topicForm.form({