NewDash

    Function toSafeInteger

    • Converts value to a safe integer. A safe integer can be compared and represented correctly.

      Parameters

      • value: string

        The value to convert.

      Returns number

      Returns the converted integer.

      5.7.0

      toSafeInteger(3.2)
      // => 3

      toSafeInteger(Number.MIN_VALUE)
      // => 0

      toSafeInteger(Infinity)
      // => 9007199254740991

      toSafeInteger('3.2')
      // => 3
    • Converts value to a safe integer. A safe integer can be compared and represented correctly.

      Parameters

      • value: number

        The value to convert.

      Returns number

      Returns the converted integer.

      5.7.0

      toSafeInteger(3.2)
      // => 3

      toSafeInteger(Number.MIN_VALUE)
      // => 0

      toSafeInteger(Infinity)
      // => 9007199254740991

      toSafeInteger('3.2')
      // => 3
    MMNEPVFCICPMFPCPTTAAATR