Options
All
  • Public
  • Public/Protected
  • All
Menu

Module func

Index

Functions

attempt

  • attempt<T, P>(func: Func<T>, defaultValue?: P, silent?: boolean): P extends T ? T : T | undefined
  • Simple try catch wrapper that returns a default value if exception was raised. If silent = false, there will be a 'console.error' call.

    export

    Type parameters

    • T

    • P = any

    Parameters

    • func: Func<T>
    • Optional defaultValue: P
    • silent: boolean = true

    Returns P extends T ? T : T | undefined

compose

  • compose<T>(...funcs: Func[]): (...args: any[]) => T
  • Type parameters

    • T = any

    Parameters

    • Rest ...funcs: Func[]

    Returns (...args: any[]) => T

      • (...args: any[]): T
      • Parameters

        • Rest ...args: any[]

        Returns T

flow

  • flow<T>(args?: any[] | any, ...funcs: Func[]): T
  • Given an initmial argument and a list of functions, each function will be executed sequentially, and the returned value is passed to the next function as argument.

    deprecated

    {{in favor of compose}}{{}}

    export

    Type parameters

    • T = any

    Parameters

    • Optional args: any[] | any
    • Rest ...funcs: Func[]

    Returns T

identity

  • identity<T>(self: T): T
  • Identity function, always return input itself

    export

    Type parameters

    • T

    Parameters

    • self: T

    Returns T

noop

  • noop(): void
  • A function that does nothing

    export

    Returns void

Generated using TypeDoc