Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const reproject = (point, source, dest, normalize = true) => {
const sourceProj = source && Proj4js.defs(source) ? new Proj4js.Proj(source) : null;
const destProj = dest && Proj4js.defs(dest) ? new Proj4js.Proj(dest) : null;
if (sourceProj && destProj) {
let p = isArray(point) ? Proj4js.toPoint(point) : Proj4js.toPoint([point.x, point.y]);
const transformed = assign({}, source === dest ? numberize(p) : Proj4js.transform(sourceProj, destProj, numberize(p)), {srs: dest});
if (normalize) {
return normalizePoint(transformed);
}
return transformed;
}
return null;
};