Socket
Socket
Sign inDemoInstall

@turf/boolean-point-on-line

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-point-on-line - npm Package Compare versions

Comparing version 6.3.0 to 6.4.0

14

dist/es/index.js

@@ -11,2 +11,3 @@ import { getCoord, getCoords } from "@turf/invariant";

* @param {boolean} [options.ignoreEndVertices=false] whether to ignore the start and end vertices.
* @param {number} [options.epsilon] Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
* @returns {boolean} true/false

@@ -38,3 +39,3 @@ * @example

}
if (isPointOnLineSegment(lineCoords[i], lineCoords[i + 1], ptCoords, ignoreBoundary)) {
if (isPointOnLineSegment(lineCoords[i], lineCoords[i + 1], ptCoords, ignoreBoundary, typeof options.epsilon === "undefined" ? null : options.epsilon)) {
return true;

@@ -46,2 +47,3 @@ }

// See http://stackoverflow.com/a/4833823/1979085
// See https://stackoverflow.com/a/328122/1048847
/**

@@ -53,6 +55,7 @@ * @private

* @param {boolean|string} excludeBoundary whether the point is allowed to fall on the line ends.
* @param {number} epsilon Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
* If true which end to ignore.
* @returns {boolean} true/false
*/
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary) {
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon) {
var x = pt[0];

@@ -69,3 +72,8 @@ var y = pt[1];

var cross = dxc * dyl - dyc * dxl;
if (cross !== 0) {
if (epsilon !== null) {
if (Math.abs(cross) > epsilon) {
return false;
}
}
else if (cross !== 0) {
return false;

@@ -72,0 +80,0 @@ }

@@ -11,2 +11,3 @@ import { Coord, Feature, LineString } from "@turf/helpers";

* @param {boolean} [options.ignoreEndVertices=false] whether to ignore the start and end vertices.
* @param {number} [options.epsilon] Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
* @returns {boolean} true/false

@@ -21,3 +22,4 @@ * @example

ignoreEndVertices?: boolean;
epsilon?: number;
}): boolean;
export default booleanPointOnLine;

@@ -13,2 +13,3 @@ "use strict";

* @param {boolean} [options.ignoreEndVertices=false] whether to ignore the start and end vertices.
* @param {number} [options.epsilon] Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
* @returns {boolean} true/false

@@ -40,3 +41,3 @@ * @example

}
if (isPointOnLineSegment(lineCoords[i], lineCoords[i + 1], ptCoords, ignoreBoundary)) {
if (isPointOnLineSegment(lineCoords[i], lineCoords[i + 1], ptCoords, ignoreBoundary, typeof options.epsilon === "undefined" ? null : options.epsilon)) {
return true;

@@ -48,2 +49,3 @@ }

// See http://stackoverflow.com/a/4833823/1979085
// See https://stackoverflow.com/a/328122/1048847
/**

@@ -55,6 +57,7 @@ * @private

* @param {boolean|string} excludeBoundary whether the point is allowed to fall on the line ends.
* @param {number} epsilon Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
* If true which end to ignore.
* @returns {boolean} true/false
*/
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary) {
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon) {
var x = pt[0];

@@ -71,3 +74,8 @@ var y = pt[1];

var cross = dxc * dyl - dyc * dxl;
if (cross !== 0) {
if (epsilon !== null) {
if (Math.abs(cross) > epsilon) {
return false;
}
}
else if (cross !== 0) {
return false;

@@ -74,0 +82,0 @@ }

{
"name": "@turf/boolean-point-on-line",
"version": "6.3.0",
"version": "6.4.0",
"description": "turf boolean-point-on-line module",

@@ -61,6 +61,6 @@ "author": "Turf Authors",

"dependencies": {
"@turf/helpers": "^6.3.0",
"@turf/invariant": "^6.3.0"
"@turf/helpers": "^6.4.0",
"@turf/invariant": "^6.4.0"
},
"gitHead": "57c8877e1e2d67effc2cdd23385c02b2a6615a49"
"gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc