lib/geo-lib.js
function isPointOnLineSegment(line1p1, line1p2, point) {
    if (line1p2.lat <= Math.max(line1p1.lat, point.lat) && line1p2.lat >= Math.min(line1p1.lat, point.lat) &&
        line1p2.lon <= Math.max(line1p1.lon, point.lon) && line1p2.lon >= Math.min(line1p1.lon, point.lon)) {
        return true;
    }
    return false;
}
function isPointOnLineSegment(line1p1, line1p2, point) {
    if (line1p2.lat <= Math.max(line1p1.lat, point.lat) && line1p2.lat >= Math.min(line1p1.lat, point.lat) &&
        line1p2.lon <= Math.max(line1p1.lon, point.lon) && line1p2.lon >= Math.min(line1p1.lon, point.lon)) {
        return true;
    }
    return false;
}
function isPointOnLineSegment ( line1p1 , line1p2 , point ) { if ( line1p2 . lat <= Math . max ( line1p1 . lat , point . lat ) && line1p2 . lat >= Math . min ( line1p1 . lat , point . lat ) && line1p2 . lon <= Math . max ( line1p1 . lon , point . lon ) && line1p2 . lon >= Math . min ( line1p1 . lon , point . lon ) ) { return true ; } return false ; }
Given three colinear points line1p1, line1p2, point, the function checks if point lies on line segment 'line'
Given three colinear points line1p1 line1p2 point the function checks if point lies on line segment line