From fc9a2ecaf432ab140d607d5996fba3bbdef9b4b9 Mon Sep 17 00:00:00 2001 From: maRci002 Date: Tue, 17 Mar 2020 00:30:13 +0100 Subject: [PATCH] fix js falsy values convert --- index.js | 4 ++-- wkt.build.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index f73336c..f59efeb 100644 --- a/index.js +++ b/index.js @@ -172,10 +172,10 @@ function cleanWKT(wkt) { ['srsCode', 'name'] ]; list.forEach(renamer); - if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) { + if (!(wkt.long0 || wkt.long0 === 0) && (wkt.longc || wkt.longc === 0) && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) { wkt.long0 = wkt.longc; } - if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { + if (!(wkt.lat_ts || wkt.lat_ts === 0) && (wkt.lat1 || wkt.lat1 === 0) && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90); wkt.lat_ts = wkt.lat1; } diff --git a/wkt.build.js b/wkt.build.js index 69b792f..00ce0e6 100644 --- a/wkt.build.js +++ b/wkt.build.js @@ -449,10 +449,10 @@ function cleanWKT(wkt) { ['srsCode', 'name'] ]; list.forEach(renamer); - if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) { + if (!(wkt.long0 || wkt.long0 === 0) && (wkt.longc || wkt.longc === 0) && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) { wkt.long0 = wkt.longc; } - if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { + if (!(wkt.lat_ts || wkt.lat_ts === 0) && (wkt.lat1 || wkt.lat1 === 0) && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90); wkt.lat_ts = wkt.lat1; }