Skip to content

Commit

Permalink
optimize attributes plus
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Jul 7, 2024
1 parent 2d309e0 commit 6e24b56
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,8 @@ public fun <A : Attribute<Unit>> Attributes(
attribute: A,
): Attributes = MapAttributes(mapOf(attribute to Unit))

public operator fun Attributes.plus(other: Attributes): Attributes = MapAttributes(content + other.content)
public operator fun Attributes.plus(other: Attributes): Attributes = when{
isEmpty() -> other
other.isEmpty() -> this
else -> MapAttributes(content + other.content)
}

0 comments on commit 6e24b56

Please sign in to comment.