Commit dacc1844 authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Edit function: format observations scatter plot

Replace if/else block with ternary operator
parent 57668697
...@@ -36,20 +36,18 @@ const formatSensorThingsApiResponseForScatterPlot = function ( ...@@ -36,20 +36,18 @@ const formatSensorThingsApiResponseForScatterPlot = function (
obsArrayOne, obsArrayOne,
obsArrayTwo obsArrayTwo
) { ) {
// When our observation arrays have DIFFERENT lengths // Check if our observation arrays have equal lengths,
if (obsArrayOne.length !== obsArrayTwo.length) { // remove the unique observations, if necessary
const [obsArrayOneFinal, obsArrayTwoFinal] = const [obsArrayOneFinal, obsArrayTwoFinal] =
checkForAndDeleteUniqueObservationsFromLargerArray( obsArrayOne.length !== obsArrayTwo.length
obsArrayOne, ? checkForAndDeleteUniqueObservationsFromLargerArray(
obsArrayTwo obsArrayOne,
); obsArrayTwo
)
return createCombinedObservationValues(obsArrayOneFinal, obsArrayTwoFinal); : [obsArrayOne, obsArrayTwo];
}
// When our observation arrays already have SAME lengths // Create the combined observations array
else { return createCombinedObservationValues(obsArrayOneFinal, obsArrayTwoFinal);
return createCombinedObservationValues(obsArrayOne, obsArrayTwo);
}
}; };
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment