requireNotNull()function

requireNotNull(value: Nullable<T>, caller: AnyCaller = requireNotNull): T
ParamType
valueNullable<T>
The value to require. required
callerAnyCaller
Function used to attribute a thrown error to the calling site. Defaults to requireNotNull
Return
T
The value, narrowed to T.
Throws
unknown
RequiredError if value is null.

Get the not-null version of a value, or throw RequiredError if it is null.

Examples

requireNotNull("a") // "a"