Options
All
  • Public
  • Public/Protected
  • All
Menu

@itfobos/ts-optional

Index

Type aliases

Callback

Callback: () => void

Gets no arguments and returns nothing

Type declaration

    • (): void
    • Returns void

Consumer

Consumer<I>: (arg: I) => void

Consumes value and returns nothing

Type parameters

  • I

Type declaration

    • (arg: I): void
    • Parameters

      • arg: I

      Returns void

Function

Function<T, R>: (arg: T) => R

Type parameters

  • T

  • R

Type declaration

    • (arg: T): R
    • Parameters

      • arg: T

      Returns R

Predicate

Predicate<T>: (arg: T) => boolean

Type parameters

  • T

Type declaration

    • (arg: T): boolean
    • Parameters

      • arg: T

      Returns boolean

Producer

Producer<I>: () => I

Type parameters

  • I

Type declaration

    • (): I
    • Returns I

Functions

isNotNullOrEmpty

  • isNotNullOrEmpty(srcStr: string | null | undefined): boolean
  • Parameters

    • srcStr: string | null | undefined

    Returns boolean

isNotNullOrEmptyArray

  • isNotNullOrEmptyArray(arr: any[] | null | undefined): boolean
  • Parameters

    • arr: any[] | null | undefined

    Returns boolean

isNotNullOrUndefined

  • isNotNullOrUndefined(obj: any): boolean

isNullOrEmpty

  • isNullOrEmpty(srcStr: string | null | undefined): boolean
  • Parameters

    • srcStr: string | null | undefined

    Returns boolean

isNullOrEmptyArray

  • isNullOrEmptyArray(arr: any[] | null | undefined): boolean
  • Parameters

    • arr: any[] | null | undefined

    Returns boolean

isNullOrUndefined

  • isNullOrUndefined(value: any): boolean

Const nopCallback

  • nopCallback(): void

requireNonEmpty

  • requireNonEmpty(str: string | null | undefined, message?: undefined | string): string
  • Check a passed string against null/undefined and string length grater than 0.

    throws

    Error(message), or Error('nullable or empty argument') if no any message has been provided

    Parameters

    • str: string | null | undefined

      source string to check

    • Optional message: undefined | string

      error will be thrown with

    Returns string

    the passed string

requireNonNull

  • requireNonNull<T>(obj: T | null | undefined, message?: undefined | string): T
  • Check a passed object against null/undefined.

    throws

    Error(message), or Error('nullable argument') if no any message has been provided

    Type parameters

    • T

    Parameters

    • obj: T | null | undefined

      source object to check

    • Optional message: undefined | string

      error will be thrown with

    Returns T

    the passed object

Generated using TypeDoc