Skip to content

Commit

Permalink
fix valueSequence
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Dec 28, 2023
1 parent f9e7d00 commit 6e20fc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Fixed
- Partially fixed a bug with `MutableMeta` observable wrappers.
- `valueSequence` now include root value. So `meta.update` works properly.

### Security

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

allprojects {
group = "space.kscience"
version = "0.7.2-dev-1"
version = "0.7.2-dev-2"
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ public operator fun <M : TypedMeta<M>> M?.get(key: String): M? = this?.get(key.p


/**
* Get a sequence of [Name]-[Value] pairs using top-down traversal of the tree
* Get a sequence of [Name]-[Value] pairs using top-down traversal of the tree.
* The sequence includes root value with empty name
*/
public fun Meta.valueSequence(): Sequence<Pair<Name, Value>> = sequence {
items.forEach { (key, item) ->
value?.let { yield(Name.EMPTY to it) }
item.value?.let { itemValue ->
yield(key.asName() to itemValue)
}
Expand Down

0 comments on commit 6e20fc3

Please sign in to comment.