Skip to content

Commit 5d214d9

Browse files
committed
refactor: clean up code formatting and improve readability in object detection methods
1 parent af93177 commit 5d214d9

File tree

1 file changed

+4
-9
lines changed
  • scratch-arduino-extensions/packages/scratch-vm/src/extensions/arduino_object_detection

1 file changed

+4
-9
lines changed

scratch-arduino-extensions/packages/scratch-vm/src/extensions/arduino_object_detection/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const menuIconURI = "";
2424

2525
const wsServerURL = `${window.location.protocol}//${window.location.hostname}:7000`;
2626

27-
2827
/**
2928
* RGB color constants for confidence visualization
3029
*/
@@ -232,16 +231,12 @@ ArduinoObjectDetection.prototype._loop = function() {
232231

233232
ArduinoObjectDetection.prototype.whenObjectDetected = function(args) {
234233
const objectLabel = args.OBJECT;
235-
return this.detectedObjects.some(detectionObject =>
236-
detectionObject.label === objectLabel
237-
);
234+
return this.detectedObjects.some(detectionObject => detectionObject.label === objectLabel);
238235
};
239236

240237
ArduinoObjectDetection.prototype.isObjectDetected = function(args) {
241238
const objectLabel = args.OBJECT;
242-
return this.detectedObjects.some(detectionObject =>
243-
detectionObject.label === objectLabel
244-
);
239+
return this.detectedObjects.some(detectionObject => detectionObject.label === objectLabel);
245240
};
246241

247242
ArduinoObjectDetection.prototype.hideBoundingBoxes = function(args) {
@@ -370,7 +365,7 @@ ArduinoObjectDetection.prototype.getDetectedObjectsCount = function() {
370365
*/
371366
ArduinoObjectDetection.prototype.getDetectedLabelsAsString = function() {
372367
const detectedLabels = this.getDetectedLabels();
373-
return detectedLabels.length > 0 ? detectedLabels.join(', ') : 'none';
368+
return detectedLabels.length > 0 ? detectedLabels.join(", ") : "none";
374369
};
375370

376371
/**
@@ -402,7 +397,7 @@ ArduinoObjectDetection.prototype._updateDetectionStates = function() {
402397
// Log detection updates for debugging
403398
const detectedLabels = Object.keys(this._detectionStates).filter(label => this._detectionStates[label]);
404399
if (detectedLabels.length > 0) {
405-
console.log(`Currently detected: ${detectedLabels.join(', ')}`);
400+
console.log(`Currently detected: ${detectedLabels.join(", ")}`);
406401
}
407402
};
408403

0 commit comments

Comments
 (0)