Skip to content
pyautark (soon)

@urban-toolkit/autk-core


@urban-toolkit/autk-core / isFeatureCollection

Function: isFeatureCollection()

isFeatureCollection(data): data is FeatureCollection<Geometry, GeoJsonProperties>

Defined in: utils-geojson.ts:31

Type guard that checks whether a value is a GeoJSON FeatureCollection.

Parameters

data

unknown

value to test.

Returns

data is FeatureCollection<Geometry, GeoJsonProperties>

true if the value has type: 'FeatureCollection' and a features array.

Throws

Never throws.

Example

ts
isFeatureCollection({ type: 'FeatureCollection', features: [] }); // true
isFeatureCollection([{ name: 'x' }]); // false

Released under the MIT License.