Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions modules/validations/impossible_oneway.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ export function validationImpossibleOneway() {
}

function nodeOccursMoreThanOnce(way, nodeID) {
let occurrences = 0;
for (const index in way.nodes) {
if (way.nodes[index] === nodeID) {
occurrences++;
if (occurrences > 1) return true;
}
}
return false;
const firstIndex = way.nodes.indexOf(nodeID);
return firstIndex !== -1 && firstIndex !== way.nodes.lastIndexOf(nodeID);
}

function isConnectedViaOtherTypes(way, node) {
Expand Down