|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
342 bytes
|
| Line | |
|---|
| 1 | import { toInteger } from './toInteger.mjs';
|
|---|
| 2 | import { MAX_SAFE_INTEGER } from '../_internal/MAX_SAFE_INTEGER.mjs';
|
|---|
| 3 | import { clamp } from '../math/clamp.mjs';
|
|---|
| 4 |
|
|---|
| 5 | function toSafeInteger(value) {
|
|---|
| 6 | if (value == null) {
|
|---|
| 7 | return 0;
|
|---|
| 8 | }
|
|---|
| 9 | return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | export { toSafeInteger };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.