From ca28998ea92ddce7f2035c09e969e9a4d5d6628f Mon Sep 17 00:00:00 2001 From: Angel Lacret Date: Thu, 12 Jun 2025 09:27:31 -0400 Subject: [PATCH 1/3] TESTS: add test for duplicated points on line string affecting v7.2.0 --- packages/turf-nearest-point-on-line/test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/turf-nearest-point-on-line/test.ts b/packages/turf-nearest-point-on-line/test.ts index 34e2e73c6..c0c8e28cd 100644 --- a/packages/turf-nearest-point-on-line/test.ts +++ b/packages/turf-nearest-point-on-line/test.ts @@ -517,3 +517,17 @@ test("turf-nearest-point-on-line -- issue 2808 redundant point support", (t) => t.end(); }); + +test("turf-nearest-point-on-line -- duplicate points on line string shouldn't break the function.", (t) => { + // @jonmiles + const line = lineString([ + [-80.191793, 25.885611], + [-80.191793, 25.885611], + [-80.191543, 25.885874], + ]); + const userPoint = point([-80.191762, 25.885587]); + const nearest = nearestPointOnLine(line, userPoint, { units: "meters" }); + t.equal(nearest.properties.dist > 4, true, "dist should be greater than 4"); + t.equal(nearest.properties.location, 0, "location should be 0"); + t.end(); +}); From 66681cf53b7d9eed2ae55b7cc2c68e40280f3da2 Mon Sep 17 00:00:00 2001 From: Angel Lacret Date: Thu, 12 Jun 2025 09:40:40 -0400 Subject: [PATCH 2/3] Add contributors --- packages/turf-nearest-point-on-line/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/turf-nearest-point-on-line/package.json b/packages/turf-nearest-point-on-line/package.json index 07488b64e..b1caa840e 100644 --- a/packages/turf-nearest-point-on-line/package.json +++ b/packages/turf-nearest-point-on-line/package.json @@ -3,6 +3,11 @@ "version": "7.2.0", "description": "Finds the nearest point on a line to a given point", "author": "Turf Authors", + "contributors": [ + "Angel Lacret <@alacret>", + "Jon Miles <@jonmiles>", + "John Ziebro <@@Insighttful>" + ], "license": "MIT", "bugs": { "url": "https://github.com/Turfjs/turf/issues" From 845240b8cfb72558c9023f412c6d4c14f88f010f Mon Sep 17 00:00:00 2001 From: Angel Lacret Date: Thu, 12 Jun 2025 09:41:30 -0400 Subject: [PATCH 3/3] Fix typo on Contributors --- packages/turf-nearest-point-on-line/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/turf-nearest-point-on-line/package.json b/packages/turf-nearest-point-on-line/package.json index b1caa840e..da7c976ba 100644 --- a/packages/turf-nearest-point-on-line/package.json +++ b/packages/turf-nearest-point-on-line/package.json @@ -6,7 +6,7 @@ "contributors": [ "Angel Lacret <@alacret>", "Jon Miles <@jonmiles>", - "John Ziebro <@@Insighttful>" + "John Ziebro <@Insighttful>" ], "license": "MIT", "bugs": {