Package-level declarations

Functions

Link copied to clipboard
inline fun <T> T.caller(ignore: Any? = null): T

Syntax-sugar for a lambda that returns this.

Link copied to clipboard
inline fun <T> Any?.castOrElse(default: () -> T): T

Casts Any to a type T or returns a default value.

Link copied to clipboard
inline fun <T> Any?.castOrNull(): T?

Casts Any to a type T or returns null.

Link copied to clipboard
inline fun <T> Any.castOrThrow(): T

Casts Any to a type T or throw a ClassCastException.

Link copied to clipboard
inline fun emptyString(ignore: Any? = null): String

Syntax-sugar for a lambda that returns an empty String.

Link copied to clipboard
@JvmName(name = "withIfExists")
inline fun <T, R> exists(receiver: T?, block: T & Any.() -> R): R?

Syntax-sugar equivalent to a with block that only executes if the receiver is not null.

Link copied to clipboard
@JvmName(name = "letIfExists")
infix inline fun <T, R> T?.exists(block: T & Any.() -> R): R?

Syntax-sugar equivalent to a run block that only executes if the receiver is not null.

Link copied to clipboard
infix inline fun <T : Any> T?.fallback(none: (NullPointerException) -> T = ::rethrow): T

Syntax-sugar for null-case of nullfold that throws a NullPointerException by default.

Link copied to clipboard
inline fun <T> T.flatmap(predicate: T.() -> Boolean, falsy: T.() -> T = ::caller, truthy: T.() -> T = ::caller): T

Syntax-sugar for a lambda that folds a receiver type T into something else of the same type.

Link copied to clipboard
inline fun <T, R> T.fold(predicate: T.() -> Boolean, falsy: T.() -> R, truthy: T.() -> R): R

Syntax-sugar for a lambda that folds a receiver type T into type R.

Link copied to clipboard
inline fun <T> Any?.instanceOf(): Boolean

Checks if the Any is an instance of type T.

Link copied to clipboard
inline fun <T> itself(value: T): T

Syntax-sugar for a lambda that returns it.

Link copied to clipboard
inline fun <In, Out> In.nullfold(none: (NullPointerException) -> Out, some: (In & Any) -> Out): Out

Syntax-sugar for a lambda folds a nullable receiver type into type Out.

Link copied to clipboard
inline fun nulls(ignore: Any? = null): Nothing?

Syntax-sugar for a lambda that returns null.

Link copied to clipboard
inline fun <Parent, Child : Any> Parent.on(instanceof: KClass<Child>, block: Child.() -> Unit): Parent

Executes the block if the Parent is an instance of type Child.

Link copied to clipboard
inline fun rethrow(throwable: Throwable): Nothing

Syntax-sugar for a lambda that throws it (provided it is a Throwable).

inline fun <T : Any> rethrow(collector: FlowCollector<T>, throwable: Throwable): Nothing

Syntax-sugar for a lambda that throws it (provided it is a Throwable) within a FlowCollector context.

Link copied to clipboard
inline fun <T> T.stringCaller(ignore: Any? = null): String

Syntax-sugar for a lambda that returns the String of this.

Link copied to clipboard
inline fun <T> stringItself(value: T): String

Syntax-sugar for a lambda that returns the String of it.

Link copied to clipboard
inline fun <In, Out> In.throwfold(throws: (Throwable) -> Out, pass: (In) -> Out): Out

Syntax-sugar for a lambda folds a potentially Throwable receiver type into type Out.

Link copied to clipboard
inline fun unit(ignore: Any? = null)

Syntax-sugar for a lambda that returns Unit.