tethys-feature-service/node_modules/proj4/lib/checkSanity.js
2023-10-02 15:04:02 +02:00

16 lines
410 B
JavaScript

export default function (point) {
checkCoord(point.x);
checkCoord(point.y);
}
function checkCoord(num) {
if (typeof Number.isFinite === 'function') {
if (Number.isFinite(num)) {
return;
}
throw new TypeError('coordinates must be finite numbers');
}
if (typeof num !== 'number' || num !== num || !isFinite(num)) {
throw new TypeError('coordinates must be finite numbers');
}
}