Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-TBT committed Sep 4, 2024
1 parent 0068e35 commit 1d5d924
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/AutoTagForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1d5d924

Please sign in to comment.