UNPKG

617 BJavaScriptView Raw
1/**
2 * Utility helpers for working with numbers.
3 *
4 * @module number
5 */
6
7import * as math from './math.js'
8import * as binary from './binary.js'
9
10export const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER
11export const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER
12
13export const LOWEST_INT32 = 1 << 31
14/**
15 * @type {number}
16 */
17export const HIGHEST_INT32 = binary.BITS31
18
19/**
20 * @module number
21 */
22
23/* istanbul ignore next */
24export const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && math.floor(num) === num)
25export const isNaN = Number.isNaN
26export const parseInt = Number.parseInt