mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-10-28 03:25:02 +08:00
feat: revamp demo
This commit is contained in:
16
demo/utils/geo.ts
Normal file
16
demo/utils/geo.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import type { registerMap } from "echarts/core";
|
||||
|
||||
type GeoJSONInput = Parameters<typeof registerMap>[1];
|
||||
|
||||
type FeatureCollectionLike = { type?: unknown };
|
||||
|
||||
export function isGeoJSONSource(value: unknown): value is GeoJSONInput {
|
||||
if (typeof value === "string") {
|
||||
return true;
|
||||
}
|
||||
if (value && typeof value === "object" && "type" in value) {
|
||||
const type = (value as FeatureCollectionLike).type;
|
||||
return type === "FeatureCollection";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user