Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "IsNumber"

Index

Interfaces

Functions

Object literals

Functions

isNumber

  • Check if a given value is a number.

    Default IsNumberOptions allow -Infinity, Infinity but disallow NaN.

    Parameters

    • target: any

      The value being checked.

    • Default value options: IsNumberOptions = IS_NUMBER_OPTIONS_DEFAULTS

      The optional configuration IsNumberOptions.

    Returns boolean

    True if the value is a number, false otherwise.

isNumberError

  • isNumberError(target: number, field: string, code?: string, options?: IsNumberOptions): boolean
  • Utility method for throwing an error if the isNumber test fails.

    throws

    IsError if the target is not a number

    Parameters

    • target: number

      The target value being checked

    • field: string

      The name of the field containing the number

    • Optional code: string

      Optional nervous system code

    • Optional options: IsNumberOptions

      Optional IsNumberOptions instance.

    Returns boolean

    false if an IsError is not thrown

Object literals

Const IS_NUMBER_OPTIONS_DEFAULTS

IS_NUMBER_OPTIONS_DEFAULTS: object

Default options for IsNumber

allowInfinity

allowInfinity: true = true

allowNaN

allowNaN: false = false

Generated using TypeDoc