mapNull

fun <D> Inspector<D?>.mapNull(default: D): Inspector<D>

Creates a new Inspector from a nullable parent inspector that either contains the original value or a given default value if the original value was null.

The resulting inspector behaves similarly to a Store created via Store.mapNull. This means that the resulting Inspector.path will be the same as if mapNull was called on an equivalent store of the same value.

fun <T> Store<T?>.mapNull(default: T): Store<T>

Creates a new Store from a nullable parent store that either contains the original value or a given default value if the original value was null.

When updating the value of the resulting Store to this default value, null is used instead updating the parent. When this Store's value would be null according to it's parent's value, the default value will be used instead.

Parameters

default

value to translate null to and from