|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
606 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Converts `value` to an integer.
|
|---|
| 3 | *
|
|---|
| 4 | * This function first converts `value` to a finite number. If the result has any decimal places,
|
|---|
| 5 | * they are removed by rounding down to the nearest whole number.
|
|---|
| 6 | *
|
|---|
| 7 | * @param {unknown} value - The value to convert.
|
|---|
| 8 | * @returns {number} Returns the number.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * toInteger(3.2); // => 3
|
|---|
| 12 | * toInteger(Number.MIN_VALUE); // => 0
|
|---|
| 13 | * toInteger(Infinity); // => 1.7976931348623157e+308
|
|---|
| 14 | * toInteger('3.2'); // => 3
|
|---|
| 15 | * toInteger(Symbol.iterator); // => 0
|
|---|
| 16 | * toInteger(NaN); // => 0
|
|---|
| 17 | */
|
|---|
| 18 | declare function toInteger(value: any): number;
|
|---|
| 19 |
|
|---|
| 20 | export { toInteger };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.