Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.reduce((memo, feature) => {
if (feature.geometry.type === "MultiPolygon") {
// Flatten any MultiPolygons to arrays of individual Polygon features,
// because `booleanOverlap` can only compare like feature types.
try {
feature = flatten(feature).features;
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
Mixpanel.track("Error", {
message: "unable to perform flatten on features",
error: e,
});
feature = [];
}
}
return memo.concat(feature);
}, [])
.filter(feature => {
getFeatures: GetFeatures = (type: 'LineString' | 'Point') =>
turfFlatten(this.props.trackGeojson as any).features.filter(
f => f && f.geometry && f.geometry.type === type,
) as any;