Const
Type guard that checks if a value is a safe integer.
A safe integer is an integer that can be exactly represented in JavaScript without precision loss. The range is [±(2^53 - 1)].
true if the value is a safe integer, false otherwise
true
false
assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER)); Copy
assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER));
Type guard that checks if a value is a safe integer.
A safe integer is an integer that can be exactly represented in JavaScript without precision loss. The range is [±(2^53 - 1)].