Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/coord/geo/GeoJSONResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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);
}
Comment on lines 163 to 165
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@100pah As the current codebase, do you think it is necessary to add JSON API check?