Options
All
  • Public
  • Public/Protected
  • All
Menu

Class contain methods for checking conditions.

Based on Guava's Preconditions. But a bit simpler.

Methods starting with verify throw on failure, while methods starting with is return boolean.

Hierarchy

  • Check

Methods

Static isNotNegative

  • isNotNegative(value: number): boolean

Checks if value is not negative.

Parameters

  • value: number

    To check if not negative.

Returns boolean

true if the value is not negative, otherwise false.

Static isNotNull

  • isNotNull<T>(value: T): boolean

Checks if a value is not null or undefined.

Type parameters

  • T

    Type of the value.

Parameters

  • value: T

    Value to check if not null or undefined.

Returns boolean

true if the value is not null or undefined, otherwise false.

Static isNull

  • isNull<T>(value: T): boolean

Checks if a value is null or undefined.

Type parameters

  • T

    Type of the value.

Parameters

  • value: T

    Value to check if null or undefined.

Returns boolean

true if the value isnull or undefined, otherwise false.

Static isPositive

  • isPositive(value: number): boolean

Checks if a value is positive.

Parameters

  • value: number

    Value to check if positive.

Returns boolean

true if the value is positive, otherwise false.

Static verify

  • verify(condition: boolean, errorOrMsg?: string | Error): void

Throws if condition is false

Parameters

  • condition: boolean

    Throws if false.

  • errorOrMsg: string | Error Optional

    Error or message to be used instead of generic.

Returns void

Static verifyNotNegative

  • verifyNotNegative(value: number, errorOrMsg?: string | Error): void

Throws if value is not a number or negative.

Parameters

  • value: number

    Throws if not a number or negative.

  • errorOrMsg: string | Error Optional

    Error or message to be used instead of generic.

Returns void

Static verifyNotNull

  • verifyNotNull<T>(value: T, errorOrMsg?: string | Error): void

Throws if value is null or undefined.

Type parameters

  • T

    Type of value being check for null.

Parameters

  • value: T

    Throws if null or undefined.

  • errorOrMsg: string | Error Optional

    Error or message to be used instead of generic.

Returns void

Static verifyPositive

  • verifyPositive(value: number, errorOrMsg?: string | Error): void

Throws if value is not a number, zero, or negative.

Parameters

  • value: number

    Throws if not a number, zero, or negative.

  • errorOrMsg: string | Error Optional

    Error or message to be used instead of generic.

Returns void

  • Inherited
  • Protected
  • Private
  • Static
  • Module
  • Object
  • Property
  • Function
  • Variable
  • Index
  • Type
  • Class
  • Interface
  • Enum
  • Constructor
  • Getter/Setter
Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.