Options
All
  • Public
  • Public/Protected
  • All
Menu

Module toSafeInteger

Index

References

Functions Lang

References

Renames and re-exports toSafeInteger

Lang Functions

  • toSafeInteger(value: string): number
  • toSafeInteger(value: number): number
  • Converts value to a safe integer. A safe integer can be compared and represented correctly.

    since

    5.7.0

    example
    toSafeInteger(3.2)
    // => 3

    toSafeInteger(Number.MIN_VALUE)
    // => 0

    toSafeInteger(Infinity)
    // => 9007199254740991

    toSafeInteger('3.2')
    // => 3

    Parameters

    • value: string

      The value to convert.

    Returns number

    Returns the converted integer.

  • Parameters

    • value: number

    Returns number