From 0cc409e0a33360199a25a49a3c8b1cd98987ced3 Mon Sep 17 00:00:00 2001 From: plainheart Date: Sun, 31 May 2026 16:49:41 +0800 Subject: [PATCH 1/2] fix(geo): fix `GeoJSONResource.parseInput` - remove unsafe and unnecessary `new Function` --- src/coord/geo/GeoJSONResource.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/coord/geo/GeoJSONResource.ts b/src/coord/geo/GeoJSONResource.ts index 93a1d71233..14f6590979 100644 --- a/src/coord/geo/GeoJSONResource.ts +++ b/src/coord/geo/GeoJSONResource.ts @@ -161,9 +161,5 @@ function calculateBoundingRect(regions: GeoJSONRegion[]): BoundingRect { } function parseInput(source: GeoJSONSourceInput): GeoJSON | GeoJSONCompressed { - return !isString(source) - ? source - : (typeof JSON !== 'undefined' && JSON.parse) - ? JSON.parse(source) - : (new Function('return (' + source + ');'))(); + return !isString(source) ? source : JSON.parse(source); } From baed728ee62d05f52d74f1d9bdd6d68575c5a46f Mon Sep 17 00:00:00 2001 From: plainheart Date: Sun, 31 May 2026 16:51:23 +0800 Subject: [PATCH 2/2] chore: fix typo in comment --- src/coord/geo/GeoJSONResource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coord/geo/GeoJSONResource.ts b/src/coord/geo/GeoJSONResource.ts index 14f6590979..d2c665c4ae 100644 --- a/src/coord/geo/GeoJSONResource.ts +++ b/src/coord/geo/GeoJSONResource.ts @@ -115,7 +115,7 @@ export class GeoJSONResource implements GeoResource { fixTextCoord(mapName, region); fixDiaoyuIsland(mapName, region); - // Some area like Alaska in USA map needs to be tansformed + // Some area like Alaska in USA map needs to be transformed // to look better const specialArea = this._specialAreas && this._specialAreas[regionName]; if (specialArea) { @@ -141,7 +141,7 @@ export class GeoJSONResource implements GeoResource { return { // For backward compatibility, use geoJson // PENDING: it has been returning them without clone. - // do we need to avoid outsite modification? + // do we need to avoid outside modification? geoJson: this._geoJSON, geoJSON: this._geoJSON, specialAreas: this._specialAreas