reports/frontend/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.js
jtricerolph 1c411e402e Add settings page for managing forecasting API key and URL via UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 14:37:36 +00:00

24 lines
850 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//#region src/compat/predicate/isSafeInteger.ts
/**
* Checks if `value` is a safe integer (between -(2^53 1) and (2^53 1), inclusive).
*
* A safe integer is an integer that can be precisely represented as a `number` in JavaScript,
* without any other integer being rounded to it.
*
* This function also serves as a type predicate in TypeScript,
* narrowing the type of the argument to `number`.
*
* @param value - The value to check
* @returns `true` if `value` is an integer and between the safe values, otherwise `false`
*
* @example
* isSafeInteger(3); // Returns: true
* isSafeInteger(Number.MIN_SAFE_INTEGER - 1); // Returns: false
* isSafeInteger(1n); // Returns: false
* isSafeInteger('1'); // Returns: false
*/
function isSafeInteger(value) {
return Number.isSafeInteger(value);
}
//#endregion
exports.isSafeInteger = isSafeInteger;