function getLineFn(x1, y1, x2, y2) {
var k = (y2 - y1) / (x2 - x1);
var b = y1 - k * x1;
return function(x, y) {
var f = x * k + b;
var d = Math.abs(y - f);
return d < 0.00001;
}
}
var x1 = 10
var y1 = 10
var x2 = 500
var y2 = 400
var isOnLine = getLineFn(x1, y1, x2, y2);
var test = isOnLine(100, 200);
console.log(test);