import { Result } from '../Result' ; import { ExtractValue } from '../types' ; export declare type Option < A > = A | null | undefined ; export declare const Some ; export declare const None ; /** Returns `Some(value)` if the provided value is non-nullable, otherwise, returns `None`. */ export declare function fromNullable < A > ( value ) ; /** Returns `Some(value)` if the provided value is not falsy, otherwise, returns `None`. */ export declare function fromFalsy < A > ( value ) ; /** Returns `Some(value)` if the given predicate function returns `true`, otherwise, returns `None`. */ export declare function fromPredicate < A > ( value , predicateFn ) ; export declare function fromPredicate < A > ( predicateFn ) ; /** Returns the result of `mapFn` if `option` is `Some(value)`, otherwise, returns `None` and `mapFn` is not called. */ export declare function map < A , B > ( option , mapFn ) ; export declare function map < A , B > ( mapFn ) ; /** Returns the result of `mapFn` (it must have a return type of `Option`) if `option` is `Some(value)`, otherwise, returns `None`. */ export declare function flatMap < A , B > ( option , mapFn ) ; export declare function flatMap < A , B > ( mapFn ) ; /** Returns the result of `mapFn` if `option` is `Some(value)`, otherwise, returns a default value. */ export declare function mapWithDefault < A , B > ( option , defaultValue , mapFn ) ; export declare function mapWithDefault < A , B > ( defaultValue , mapFn ) ; /** Returns `Some(value)` if the result of `mapFn` is non-nullable, otherwise, returns `None`. */ export declare function mapNullable < A , B > ( option , mapFn ) ; export declare function mapNullable < A , B > ( mapFn ) ; /** Returns `Some(value)` if `option` is `Some(value)` and the result of `predicateFn` is truthy, otherwise, returns `None`. */ export declare function filter < A > ( option , predicateFn ) ; export declare function filter < A > ( predicateFn ) ; /** Returns `value` if `option` is `Some(value)`, otherwise, returns a default value. */ export declare function getWithDefault < A > ( option , defaultValue ) ; export declare function getWithDefault < A > ( defaultValue ) ; /** Returns `value` if `option` is `Some(value)`, otherwise, throws an exception. */ export declare function getExn < A > ( option ) ; /** Returns `value` if `option` is `Some(value)`, otherwise, returns `null`. */ export declare function toNullable < A > ( option ) ; /** Returns `value` if `option` is `Some(value)`, otherwise, returns `undefined`. */ export declare function toUndefined < A > ( option ) ; /** Returns `Ok(value)` if `option` is `Some(value)`, otherwise, returns `Error(errorValue)`, both `Ok` and `Error` come from the `Result` type. */ export declare function toResult < A , B > ( option , errorValue ) ; export declare function toResult < A , B > ( errorValue ) ; /** Returns the result of `someFn` if `option` is `Some(value)`, otherwise, returns the result of `noneFn`. */ export declare function match < A , B > ( option , someFn , noneFn ) ; export declare function match < A , B > ( someFn , noneFn ) ; /** Returns `true` if the provided `option` is `None`, otherwise, returns `false`. */ export declare function isNone < A > ( option ) ; /** Returns `true` if the provided `option` is `Some(value)`, otherwise, returns `false`. */ export declare function isSome < A > ( option ) ; /** Applies a side-effect function to the value in `Some`, and returns the original `option`. */ export declare function tap < A > ( option , someFn ) ; export declare function tap < A > ( someFn ) ; /** Checks if `option` is the `Some` variant and contains the given value. */ export declare function contains < A > ( option , value ) ; export declare function contains < A > ( value ) ; /** Combines two Options into a single Option containing a tuple of their values, if both Options are `Some` variants, otherwise, returns `None`. */ export declare function zip < A , B > ( sndOption ) ; export declare function zip < A , B > ( fstOption , sndOption ) ; /** Combines two Options into a single Option. The new value is produced by applying the given function to both values, if both Options are `Some` variants, otherwise, returns `None`. */ export declare function zipWith < A , B , C > ( fstOption , sndOption , mapFn ) ; export declare function zipWith < A , B , C > ( sndOption , mapFn ) ;