Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function lineOffsetFeature(line, distance, units) {
var segments = [];
var offsetDegrees = lengthToDegrees(distance, units);
var coords = getCoords(line);
var finalCoords = [];
coords.forEach(function (currentCoords, index) {
if (index !== coords.length - 1) {
var segment = processSegment(currentCoords, coords[index + 1], offsetDegrees);
segments.push(segment);
if (index > 0) {
var seg2Coords = segments[index - 1];
var intersects = intersection(segment, seg2Coords);
// Handling for line segments that aren't straight
if (intersects !== false) {
seg2Coords[1] = intersects;
segment[0] = intersects;
}