tethys-feature-service/node_modules/proj4/lib/checkSanity.js

16 lines
410 B
JavaScript
Raw Normal View History

2023-10-02 13:04:02 +00:00
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');
}
}