Skip to content

Commit

Permalink
Usage of "for...of loop" (instead Array.prototype.forEach()) to break…
Browse files Browse the repository at this point in the history
… out of the loop
  • Loading branch information
seicke committed Aug 29, 2024
1 parent e938a47 commit 3810cc7
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,32 +109,31 @@ export default defineComponent({
|| !submodelElement.semanticId.keys
|| submodelElement.semanticId.keys.length == 0) return false;

let result = false;
submodelElement.semanticId.keys.forEach((key: any) => {
for (const key of submodelElement.semanticId.keys) {

if (key.value.startsWith('http://') || 'https://') {
// e.g. IDTA IRI like
if (new RegExp('\/\d\/\d\/{0,1}' + '$').test(semanticId)) {
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
} else {
if (key.value.startsWith(semanticId)) result = true;
if (key.value.startsWith(semanticId)) return true;
}
} else if (key.value.startsWith('0173-1')) {
// ECLASS IRDI like 0173-1#01-AHF578#001 resp. 0173-1-01-AHF578-001
if (new RegExp('[#-]{1}\d{3}$').test(semanticId)) {
// ECLASS IRDI with version (like 0173-1#01-AHF578#001 resp. 0173-1-01-AHF578-001)
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
} else {
// ECLASS IRDI without version (like 0173-1#01-AHF578 resp. 0173-1-01-AHF578)
if (key.value.startsWith(semanticId)) result = true;
if (key.value.startsWith(semanticId)) return true;
}
} else {
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
}


});
return result;
}
return false;
},

// Function to check if the valueType is a number
Expand Down

0 comments on commit 3810cc7

Please sign in to comment.