Skip to content

Commit

Permalink
refactor: Use template literals in FieldDropdown validator.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko committed Nov 4, 2024
1 parent c330f5c commit e4496dc
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions core/field_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,22 +766,14 @@ export class FieldDropdown extends Field<string> {
if (!Array.isArray(tuple)) {
foundError = true;
console.error(
'Invalid option[' +
i +
']: Each FieldDropdown option must be an ' +
'array. Found: ',
tuple,
`Invalid option[${i}]: Each FieldDropdown option must be an array.
Found: ${tuple}`,
);
} else if (typeof tuple[1] !== 'string') {
foundError = true;
console.error(
'Invalid option[' +
i +
']: Each FieldDropdown option id must be ' +
'a string. Found ' +
tuple[1] +
' in: ',
tuple,
`Invalid option[${i}]: Each FieldDropdown option id must be a string.
Found ${tuple[1]} in: ${tuple}`,
);
} else if (
tuple[0] &&
Expand All @@ -790,13 +782,8 @@ export class FieldDropdown extends Field<string> {
) {
foundError = true;
console.error(
'Invalid option[' +
i +
']: Each FieldDropdown option must have a ' +
'string label or image description. Found' +
tuple[0] +
' in: ',
tuple,
`Invalid option[${i}]: Each FieldDropdown option must have a string
label or image description. Found ${tuple[0]} in: ${tuple}`,
);
}
}
Expand Down

0 comments on commit e4496dc

Please sign in to comment.