Skip to content

Commit

Permalink
improve condition to check if the value or the default value of a cir…
Browse files Browse the repository at this point in the history
…cuit input is provided in the circuit input parser; Simplify calculateStringCharCodeSum call in case of string type
  • Loading branch information
ognjenkurtic committed Feb 5, 2024
1 parent 7d08b3a commit 572bdb6
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class CircuitInputsParserService {
mapping.payloadJsonPath,
);

if (!value && !mapping.defaultValue) {
if (value === undefined && mapping.defaultValue === undefined) {
this.logger.logError(
`Missing value and default value for mapping ${cim.mapping} while mapping circuit inputs for payload ${payload}`,
);
Expand All @@ -26,9 +26,7 @@ export class CircuitInputsParserService {

switch (mapping.dataType) {
case 'string':
result[mapping.circuitInput] = value
? this.calculateStringCharCodeSum(value)
: this.calculateStringCharCodeSum(mapping.defaultValue);
result[mapping.circuitInput] = this.calculateStringCharCodeSum(value || mapping.defaultValue);
break;

case 'integer':
Expand Down

0 comments on commit 572bdb6

Please sign in to comment.