Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
endServicesStops.forEach(({ service: s, stops, route: r }) => {
// console.log(serviceStops, stops);
const intersectedStops = intersect(stops, serviceStops);
if (intersectedStops.length) {
const startIndex = intersectedStops.indexOf(startStop.number);
if (startIndex > -1) intersectedStops.splice(startIndex, 1);
const endIndex = intersectedStops.indexOf(endStop.number);
if (endIndex > -1) intersectedStops.splice(endIndex, 1);
if (intersectedStops.length) {
results.push({
startStop,
startService: service,
startRoute: route,
stopsBetween: intersectedStops,
endRoute: r,
endService: s,
endStop,
});