rhodonite
    Preparing search index...

    Class None

    A class representing an Option that does not contain a value. This is the "None" variant of the Option type, indicating the absence of a value.

    Implements

    • IOption<never>
    Index

    Constructors

    Methods

    • Returns this None instance, ignoring the provided function. Since there's no value to apply the function to, None is returned.

      Type Parameters

      • U

        The type of the value that would be returned by the function

      Parameters

      • _f: (value: never) => Option<NonNullable<U>>

      Returns Option<NonNullable<U>>

      This None instance

    • Type guard that always returns true for None instances.

      Returns this is None

      Always true, indicating this Option contains no value

    • Type guard that always returns false for None instances.

      Returns this is Some<never>

      Always false, indicating this Option contains no value

    • Executes the None handler function since this Option contains no value.

      Type Parameters

      • U

        The return type of the match functions

      Parameters

      • obj: { None: () => U | NonNullable<U>; Some: (value: never) => U | NonNullable<U> }

        Object containing Some and None handler functions

      Returns U | NonNullable<U>

      The result of executing obj.None

    • Returns the result of the provided function since this Option has no value. This provides an alternative Option when the current one is None.

      Type Parameters

      • U

        The type of the alternative Option

      Parameters

      • f: () => Option<NonNullable<U>>

        Function that returns an alternative Option

      Returns Option<NonNullable<U>>

      The result of executing f()

    • Throws an error since this Option contains no value. This method should only be called when you're certain the Option contains a value.

      Returns never

      Never returns (always throws)

      Always throws since None has no value

    • Returns the provided default value since this Option contains no value.

      Type Parameters

      • T

        The type of the default value

      Parameters

      • value: NonNullable<T>

        The default value to return

      Returns NonNullable<T>

      The provided default value

    • Returns the result of the provided function since this Option contains no value.

      Type Parameters

      • T

        The type of the value returned by the function

      Parameters

      • f: () => NonNullable<T>

        Function that returns a default value

      Returns NonNullable<T>

      The result of executing f()

    • Returns undefined since this Option contains no value. This provides interoperability with standard JavaScript nullable patterns.

      Returns never

      Always undefined