Kit
Functions

isOption

isOption<T>(input): input is Option<T>

Checks whether the given value is an Option.

This function determines whether an input follows the Option<T> structure.

Type Parameters

Type ParameterDefault typeDescription
TunknownThe type of the contained value.

Parameters

ParameterTypeDescription
inputunknownThe value to check.

Returns

input is Option<T>

true if the value is an Option, false otherwise.

Example

Checking for Option values.

isOption(some(42));        // true
isOption(none());          // true
isOption(42);              // false
isOption(null);            // false
isOption("anything else"); // false

See

Option

On this page