Skip to content

Commit

Permalink
split asFeature (js issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
jillesvangurp committed Jan 9, 2024
1 parent 2054746 commit 98a3d04
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/commonMain/kotlin/com/jillesvangurp/geojson/geojson.kt
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,15 @@ fun JsonObjectBuilder.description(description: String) = put("description", desc
fun Geometry.asFeature(
properties: JsonObject? = null,
bbox: BoundingBox? = null,
propertiesBuilder: (JsonObjectBuilder.() -> Unit)? = null
): Feature {
val ps = properties ?: buildJsonObject {
propertiesBuilder?.invoke(this)
return Feature(this, properties, bbox)
}
fun Geometry.asFeatureWithProperties(
bbox: BoundingBox? = null,
propertiesBuilder: (JsonObjectBuilder.() -> Unit)
): Feature {
val ps = buildJsonObject {
propertiesBuilder.invoke(this)
}

return Feature(this, ps, bbox)
Expand Down

0 comments on commit 98a3d04

Please sign in to comment.