code: function findPointOrientation(line1p1, line1p2, point) {
      // See http://www.geeksforgeeks.org/orientation-3-ordered-points/
      // for details of below formula.
      let val = (line1p2.lon - line1p1.lon) * (point.lat - line1p2.lat) -
      (line1p2.lat - line1p1.lat) * (point.lon - line1p2.lon);
      if (val === 0) {
          return 0;
      }  // colinear
      return (val > 0) ? 1 : 2; // clock or counterclock wise
  }
docs: To find findPointOrientation of ordered triplet (line1p1, line1p2, point). The function returns following values 0 --> line1p1, line1p2 and point are colinear 1 --> Clockwise 2 --> Counterclockwise