Skip to content

Commit

Permalink
Use Array.values() for iteration (#1682)
Browse files Browse the repository at this point in the history
Prevent issues when the user has added a function to the Array prototype
  • Loading branch information
mccahan authored Oct 2, 2024
1 parent 850be4e commit 69b49c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Resources/queries/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
const $li = $('<li />').addClass(csscls('table-list-item'));
const $muted = $('<span />').addClass(css('text-muted'));

for (const i in values) {
for (const i in values.values()) {
if (showLineNumbers) {
$ul.append($li.clone().append([$muted.clone().text(`${i}:`), '&nbsp;', $('<span/>').text(values[i])]));
} else {
Expand All @@ -353,7 +353,7 @@
const $muted = $('<span />').addClass(css('text-muted'));

const values = [];
for (const trace of traces) {
for (const trace of traces.values()) {
const $span = $('<span/>').text(trace.name || trace.file);
if (trace.namespace) {
$span.prepend(`${trace.namespace}::`);
Expand Down

0 comments on commit 69b49c1

Please sign in to comment.