From 1d5d9248d25a2b0f3f4eeaa4c6f63d0f81fad386 Mon Sep 17 00:00:00 2001 From: Tom-TBT Date: Wed, 4 Sep 2024 08:40:31 +0200 Subject: [PATCH] minor refactor --- src/AutoTagForm.jsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/AutoTagForm.jsx b/src/AutoTagForm.jsx index 1f493f9..f7787c7 100644 --- a/src/AutoTagForm.jsx +++ b/src/AutoTagForm.jsx @@ -62,17 +62,11 @@ export default class AutoTagForm extends React.Component { } tokenValueCheck (tokenValue) { - // Reject empty tokens - if (tokenValue.length === 0) { - return false; - } - - // Accept anything else - return true; + return tokenValue.length > 0 } - addOrUpdateToken(image, tagValuesMap, tokenMap, value) { + addOrUpdateToken(tagValuesMap, tokenMap, value) { let token; @@ -117,12 +111,12 @@ export default class AutoTagForm extends React.Component { let tokens = image.clientPath.split(regexPattern); tokens.forEach(value => - imageTokens.add(this.addOrUpdateToken(image, tagValuesMap, tokenMap, value)) + imageTokens.add(this.addOrUpdateToken(tagValuesMap, tokenMap, value)) ); tokens = image.name.split(regexPattern); // Splitting on brackets too tokens.forEach(value => - imageTokens.add(this.addOrUpdateToken(image, tagValuesMap, tokenMap, value)) + imageTokens.add(this.addOrUpdateToken(tagValuesMap, tokenMap, value)) ); // Return the set of tokens that are present on this image