Skip to content

Commit 75a59fe

Browse files
committed
refactor: spelling: use indices over indexes
1 parent e97d8cb commit 75a59fe

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/scenario-editor/utils/valhalla.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ function handleGraphHopperRouting (path: Path, individualLegs: boolean = false):
6565
// Keep track of the segment point intervals to split the line segment at.
6666
// This appears to be the most reliable way to split up the geometry
6767
// (previously distance was used here, but that provided inconstent results).
68-
const segmentPointIndexes = [0]
69-
// Iterate over the instructions, accumulating segment point indexes at each
70-
// waypoint encountered. Indexes are used to slice the line geometry when
68+
const segmentPointIndices = [0]
69+
// Iterate over the instructions, accumulating segment point indices at each
70+
// waypoint encountered. Indices are used to slice the line geometry when
7171
// individual legs are needed. NOTE: Waypoint === routing point provided in
7272
// the request.
7373
instructions.forEach((instruction, i) => {
7474
if (instruction.text.match(/Waypoint (\d+)/) || i === instructions.length - 1) {
75-
segmentPointIndexes.push(instruction.interval[0])
75+
segmentPointIndices.push(instruction.interval[0])
7676
}
7777
})
78-
// Once all of the indexes have been found, slice the decoded polyline up
79-
// at the provided indexes.
80-
if (segmentPointIndexes.length > 2) {
81-
for (var i = 1; i < segmentPointIndexes.length; i++) {
82-
// Get the indexes of the points that the entire path should be sliced at
78+
// Once all of the indices have been found, slice the decoded polyline up
79+
// at the provided indices.
80+
if (segmentPointIndices.length > 2) {
81+
for (var i = 1; i < segmentPointIndices.length; i++) {
82+
// Get the indices of the points that the entire path should be sliced at
8383
// Note: 'to' index is incremented by one because it is not inclusive.
84-
const [from, to] = [segmentPointIndexes[i - 1], segmentPointIndexes[i] + 1]
84+
const [from, to] = [segmentPointIndices[i - 1], segmentPointIndices[i] + 1]
8585
const segment = decodedPolyline.slice(from, to)
8686
segments.push(segment)
8787
}
@@ -120,7 +120,7 @@ export async function polyline (
120120
let count = 0
121121
const j = points.length
122122
for (let i = 0; i < j; i += chunk) {
123-
// Offset the slice indexes so that the next chunk begins with the
123+
// Offset the slice indices so that the next chunk begins with the
124124
const offset = count * -1
125125
const beginIndex = i + offset
126126
const endIndex = i + chunk + offset

0 commit comments

Comments
 (0)