|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
612 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Converts `value` to a safe integer.
|
|---|
| 3 | *
|
|---|
| 4 | * A safe integer can be compared and represented correctly.
|
|---|
| 5 | *
|
|---|
| 6 | * @param {any} value - The value to convert.
|
|---|
| 7 | * @returns {number} Returns the value converted to a safe integer.
|
|---|
| 8 | *
|
|---|
| 9 | * @example
|
|---|
| 10 | * toSafeInteger(3.2); // => 3
|
|---|
| 11 | * toSafeInteger(Number.MAX_VALUE); // => 9007199254740991
|
|---|
| 12 | * toSafeInteger(Infinity); // => 9007199254740991
|
|---|
| 13 | * toSafeInteger('3.2'); // => 3
|
|---|
| 14 | * toSafeInteger(NaN); // => 0
|
|---|
| 15 | * toSafeInteger(null); // => 0
|
|---|
| 16 | * toSafeInteger(-Infinity); // => -9007199254740991
|
|---|
| 17 | */
|
|---|
| 18 | declare function toSafeInteger(value: any): number;
|
|---|
| 19 |
|
|---|
| 20 | export { toSafeInteger };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.