Skip to main content
Version: Next

is.infinity

is.infinity(target: unknown)โ€‹

The is.infinity method takes one argument, which is the value to be checked for infinity. If the value is positive infinity or negative infinity, the method returns true. Otherwise, it returns false.

Specificationโ€‹

  • Target argument: required.
  • Checks if the given "target" type is infinity.

Informationโ€‹

  • Unit tests: โœ…

Examplesโ€‹

is.infinity(Number.POSITIVE_INFINITY) // true
is.infinity(Number.NEGATIVE_INFINITY) // true
is.infinity(Infinity) // true

is.infinity(0) // false
is.infinity(2) // false
is.infinity(-2) // false
is.infinity(BigInt(2)) // false
is.infinity(2n) // false
is.infinity(-32n) // false
is.infinity(BigInt(1)) // false
is.infinity(1) // false
is.infinity(-1) // false
is.infinity('undefined') // false
is.infinity('null') // false
is.infinity(Symbol()) // false
is.infinity(null) // false
is.infinity(true) // false
is.infinity([]) // false
is.infinity(false) // false
is.infinity("") // false
is.infinity('') // false
is.infinity(``) // false
is.infinity({}) // false
is.infinity(undefined) // false
is.infinity(Function) // false
is.infinity(() => {}) // false
is.infinity(BigInt) // false
is.infinity(Symbol) // false
is.infinity(NaN) // false
// And all other known types will return false

Reversal boolean resultโ€‹

is.not_infinity(Number.POSITIVE_INFINITY) // false
is.not_infinity(Number.NEGATIVE_INFINITY) // false
is.notinfinity(Infinity) // false

is.not_infinity(0) // true
is.not_infinity(2) // true
is.not_infinity(-2) // true
is.not_infinity(BigInt(2)) // true
is.not_infinity(2n) // true
is.not_infinity(-32n) // true
is.not_infinity(BigInt(1)) // true
is.not_infinity(1) // true
is.not_infinity(-1) // true
is.not_infinity('undefined') // true
is.not_infinity('null') // true
is.not_infinity(Symbol()) // true
is.not_infinity(null) // true
is.not_infinity(true) // true
is.not_infinity([]) // true
is.not_infinity(false) // true
is.not_infinity("") // true
is.not_infinity('') // true
is.not_infinity(``) // true
is.not_infinity({}) // true
is.not_infinity(undefined) // true
is.not_infinity(Function) // true
is.not_infinity(() => {}) // true
is.not_infinity(BigInt) // true
is.not_infinity(Symbol) // true
is.not_infinity(NaN) // true
// And all other known types will return true