Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Emptyable

Emptyable: object

Type declaration

  • length: number

Nullable

Nullable: null | undefined

Functions

Const fromEmpty

  • fromEmpty<T>(xs: T): Maybe<T>
  • Converts a value that may be empty, such as a string or an array, to a maybe. It will accept anything that responds to length. If the value is has a length of 0, then Nothing is returned. If the value is anything else, it is returned wrapped in a Just.

    Type parameters

    Parameters

    • xs: T

    Returns Maybe<T>

Const fromNullable

  • Converts a value that may be null or undefined to a maybe. If the value is null or undefined, then Nothing is returned. If the value is anything else, it is returned wrapped in a Just.

    Type parameters

    • T

    Parameters

    Returns Maybe<T>

Const isJust

  • isJust(maybe: Maybe<any>): boolean
  • Returns true if maybe is an instance of Just

    Example: Remove Nothing values from an array

    const maybes: Maybe<string>[]
    maybes.filter(isJust)
    

    Parameters

    Returns boolean

Const isNothing

  • isNothing(maybe: Maybe<any>): boolean
  • Returns true if maybe is an instance of Nothing

    Example: Count the Nothings

    const maybes: Maybe<string>[];
    maybes.filter(isNothing).length;
    

    Parameters

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc