Skip to content

Commit

Permalink
Removing unnecessary string convertions
Browse files Browse the repository at this point in the history
  • Loading branch information
BALEHOK committed Oct 12, 2021
1 parent bf4f30d commit 3e7085d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/devTools/editor/validators/traceErrorGeneralValidator.ts
Expand Up @@ -22,11 +22,10 @@ function traceErrorGeneralValidator(
errorTraceEntry: TraceError,
blockIndex: number
) {
const blockIndexString = String(blockIndex);
// eslint-disable-next-line security/detect-object-injection
if (!pipelineErrors[blockIndexString]) {
if (!pipelineErrors[blockIndex]) {
// eslint-disable-next-line security/detect-object-injection
pipelineErrors[blockIndexString] = errorTraceEntry.error.message;
pipelineErrors[blockIndex] = errorTraceEntry.error.message;
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/devTools/editor/validators/traceErrorInputValidator.ts
Expand Up @@ -40,21 +40,19 @@ function traceErrorInputValidator(
return;
}

const blockIndexString = String(blockIndex);

for (const unit of traceError.errors) {
const property = requiredFieldRegex.exec(unit.error)?.groups.property;
if (property) {
const propertyNameInPipeline = joinName(
blockIndexString,
String(blockIndex),
"config",
property
);
const errorMessage = "Error from the last run: This field is required.";
set(pipelineErrors, propertyNameInPipeline, errorMessage);
} else if (unit.error) {
// eslint-disable-next-line security/detect-object-injection
pipelineErrors[blockIndexString] = unit.error;
pipelineErrors[blockIndex] = unit.error;
}
}
}
Expand Down

0 comments on commit 3e7085d

Please sign in to comment.