Skip to content

Commit

Permalink
fix(geojson): hot path optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Sep 20, 2024
1 parent 0329f64 commit 5b5fd17
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions geojson/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export const unmarshal = (position: geojson.Position): Point => {
* Returns true IFF the two positions are equal.
*/
export const equal = (a: geojson.Position, b: geojson.Position, epsilon = 0) => {
if (epsilon == 0) return a[0] === b[0] && a[1] === b[1]
return Math.abs(a[0] - b[0]) <= epsilon && Math.abs(a[1] - b[1]) <= epsilon
}

0 comments on commit 5b5fd17

Please sign in to comment.