Ivan Starkov 07368e23ad Move 2 yarn, add prettier, update linters (#360)
* Move 2 yarn, add prettier, update linters

* Fix linting error
2017-04-11 00:47:54 +03:00

11 lines
307 B
JavaScript

const ptInSect = (x, a, b) => (x - a) * (x - b) <= 0;
export default ({ nw, se }, pt) => {
const lngs = nw.lng < se.lng
? [[nw.lng, se.lng]]
: [[nw.lng, 180], [-180, se.lng]];
return ptInSect(pt.lat, se.lat, nw.lat) &&
lngs.some(([lngFrom, lngTo]) => ptInSect(pt.lng, lngFrom, lngTo));
};