source: node_modules/es-toolkit/dist/compat/util/toSafeInteger.mjs

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 
1import { toInteger } from './toInteger.mjs';
2import { MAX_SAFE_INTEGER } from '../_internal/MAX_SAFE_INTEGER.mjs';
3import { clamp } from '../math/clamp.mjs';
4
5function toSafeInteger(value) {
6 if (value == null) {
7 return 0;
8 }
9 return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
10}
11
12export { toSafeInteger };
Note: See TracBrowser for help on using the repository browser.