{"version":3,"file":"index.es.js","sources":["../index.js"],"sourcesContent":["export default function flatten(gj) {\n switch ((gj && gj.type) || null) {\n case \"FeatureCollection\":\n gj.features = gj.features.reduce(function(mem, feature) {\n return mem.concat(flatten(feature));\n }, []);\n return gj;\n case \"Feature\":\n if (!gj.geometry) return [gj];\n return flatten(gj.geometry).map(function(geom) {\n var data = {\n type: \"Feature\",\n properties: JSON.parse(JSON.stringify(gj.properties)),\n geometry: geom\n };\n if (gj.id !== undefined) {\n data.id = gj.id;\n }\n return data;\n });\n case \"MultiPoint\":\n return gj.coordinates.map(function(_) {\n return { type: \"Point\", coordinates: _ };\n });\n case \"MultiPolygon\":\n return gj.coordinates.map(function(_) {\n return { type: \"Polygon\", coordinates: _ };\n });\n case \"MultiLineString\":\n return gj.coordinates.map(function(_) {\n return { type: \"LineString\", coordinates: _ };\n });\n case \"GeometryCollection\":\n return gj.geometries.map(flatten).reduce(function(memo, geoms) {\n return memo.concat(geoms);\n }, []);\n case \"Point\":\n case \"Polygon\":\n case \"LineString\":\n return [gj];\n }\n}\n"],"names":["flatten","gj","type","features","reduce","mem","feature","concat","geometry","map","geom","data","properties","JSON","parse","stringify","undefined","id","coordinates","_","geometries","memo","geoms"],"mappings":"AAAwBA,SAAAA,EAAQC,GAC9B,OAASA,GAAMA,EAAGC,MAAS,MACzB,IAAK,oBAIH,OAHAD,EAAGE,SAAWF,EAAGE,SAASC,OAAO,SAASC,EAAKC,GAC7C,OAAOD,EAAIE,OAAOP,EAAQM,GAC5B,EAAG,IACML,EACX,IAAK,UACH,OAAKA,EAAGO,SACMR,EAACC,EAAGO,UAAUC,IAAI,SAASC,GACvC,IAAQC,EAAG,CACTT,KAAM,UACNU,WAAYC,KAAKC,MAAMD,KAAKE,UAAUd,EAAGW,aACzCJ,SAAUE,GAKZ,YAHcM,IAAVf,EAAGgB,KACLN,EAAKM,GAAKhB,EAAGgB,KAGjB,GAXyB,CAAChB,GAY5B,IAAK,aACH,OAAOA,EAAGiB,YAAYT,IAAI,SAASU,GACjC,MAAO,CAAEjB,KAAM,QAASgB,YAAaC,EACvC,GACF,IAAK,eACH,OAASlB,EAACiB,YAAYT,IAAI,SAASU,GACjC,MAAO,CAAEjB,KAAM,UAAWgB,YAAaC,EACzC,GACF,IAAK,kBACH,OAAOlB,EAAGiB,YAAYT,IAAI,SAASU,GACjC,MAAO,CAAEjB,KAAM,aAAcgB,YAAaC,EAC5C,GACF,IAAK,qBACH,OAAOlB,EAAGmB,WAAWX,IAAIT,GAASI,OAAO,SAASiB,EAAMC,GACtD,OAAWD,EAACd,OAAOe,EACrB,EAAG,IACL,IAAK,QACL,IAAK,UACL,IAAK,aACH,MAAO,CAACrB,GAEd"}