main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
298 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import isFinite from '../../isFinite';
|
---|
| 2 |
|
---|
| 3 | const truncPonyfill = (v) => {
|
---|
| 4 | const numV = Number(v);
|
---|
| 5 |
|
---|
| 6 | if (!isFinite(numV)) {
|
---|
| 7 | return numV;
|
---|
| 8 | }
|
---|
| 9 |
|
---|
| 10 | // eslint-disable-next-line no-nested-ternary
|
---|
| 11 | return numV - (numV % 1) || (numV < 0 ? -0 : numV === 0 ? numV : 0);
|
---|
| 12 | };
|
---|
| 13 |
|
---|
| 14 | export default truncPonyfill;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.