Skip to content

Commit

Permalink
avoid a while loop to prevent infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamouGisaia committed Nov 26, 2024
1 parent 8fc6502 commit d79b1f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/services/visualize.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export class VisualizeService {
/** Fetch all elements between {} in the template. */
const regex = new RegExp(/{([^}]+)}/g);
const fields = [];
let match;
while ((match = regex.exec(urlTemplate)) !== null) {
fields.push(match[1]);
const matches = [...urlTemplate.matchAll(regex)];
if (!!matches) {
matches.filter(m => !!m && Array.isArray(m) && m.length > 1).forEach(m => fields.push(m[1]));
}
if (fields) {
return fields
Expand Down

0 comments on commit d79b1f9

Please sign in to comment.