This Method isPointNearLine is Solve my problem.
Code Snippet.
import * as geolib from 'geolib';
const returnObj=(latitude,longitude)=>{
return {latitude, longitude}
}
const IsLies = geolib.isPointNearLine(
returnObj(25.976424, -80.238400), ////point
returnObj(25.97641, -80.24045), ////start
returnObj(25.97647,-80.23818), ///end
20 ////distance in meter
);
it will return true and false.
There is another approach is we can user @turf/boolean-point-on-line
Code Snippet
var pt = turf.point([74.276089,31.478847]); //// NearPoint
///Note [[Start Point],[NearPoint],[EndPoint]]
var line = turf.lineString([[74.277908,31.479470],[74.276089,31.478847],[74.274402,31.478452]]);
var isPointOnLine = turf.booleanPointOnLine(pt, line);
it will also return True and false if Points lies on line.