fix valueSequence
This commit is contained in:
parent
f9e7d0098f
commit
6e20fc3929
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Partially fixed a bug with `MutableMeta` observable wrappers.
|
- Partially fixed a bug with `MutableMeta` observable wrappers.
|
||||||
|
- `valueSequence` now include root value. So `meta.update` works properly.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "space.kscience"
|
group = "space.kscience"
|
||||||
version = "0.7.2-dev-1"
|
version = "0.7.2-dev-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
@ -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 {
|
public fun Meta.valueSequence(): Sequence<Pair<Name, Value>> = sequence {
|
||||||
items.forEach { (key, item) ->
|
items.forEach { (key, item) ->
|
||||||
|
value?.let { yield(Name.EMPTY to it) }
|
||||||
item.value?.let { itemValue ->
|
item.value?.let { itemValue ->
|
||||||
yield(key.asName() to itemValue)
|
yield(key.asName() to itemValue)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user