From: Jukka Kurkela Date: Fri, 14 Feb 2020 19:12:23 +0000 (+0200) Subject: Change remaining `for of` loops to regular ones (#7103) X-Git-Tag: v3.0.0-alpha~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7397a41fac0e9a57c969148eddc2805c8b249ee7;p=thirdparty%2FChart.js.git Change remaining `for of` loops to regular ones (#7103) --- diff --git a/src/helpers/helpers.segment.js b/src/helpers/helpers.segment.js index 8415fd81f..f40d8a889 100644 --- a/src/helpers/helpers.segment.js +++ b/src/helpers/helpers.segment.js @@ -122,9 +122,10 @@ export function _boundSegment(segment, points, bounds) { */ export function _boundSegments(line, bounds) { const result = []; + const segments = line.segments; - for (const segment of line.segments) { - const sub = _boundSegment(segment, line.points, bounds); + for (let i = 0; i < segments.length; i++) { + const sub = _boundSegment(segments[i], line.points, bounds); if (sub.length) { result.push(...sub); } diff --git a/src/plugins/plugin.filler.js b/src/plugins/plugin.filler.js index f9114e516..4843c9c3f 100644 --- a/src/plugins/plugin.filler.js +++ b/src/plugins/plugin.filler.js @@ -265,6 +265,7 @@ function _getEdge(a, b, prop, fn) { } function _segments(line, target, property) { + const segments = line.segments; const points = line.points; const tpoints = target.points; const parts = []; @@ -280,7 +281,8 @@ function _segments(line, target, property) { } } - for (const segment of line.segments) { + for (let i = 0; i < segments.length; i++) { + const segment = segments[i]; const bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop); if (!target.segments) { @@ -298,13 +300,14 @@ function _segments(line, target, property) { // Get all segments from `target` that intersect the bounds of current segment of `line` const subs = _boundSegments(target, bounds); - for (const sub of subs) { + for (let j = 0; j < subs.length; ++j) { + const sub = subs[j]; const subBounds = getBounds(property, tpoints[sub.start], tpoints[sub.end], sub.loop); const fillSources = _boundSegment(segment, points, subBounds); - for (const source of fillSources) { + for (let k = 0; k < fillSources.length; k++) { parts.push({ - source, + source: fillSources[k], target: sub, start: { [property]: _getEdge(bounds, subBounds, 'start', Math.max)