Number Helpers
Utility functions for working with number operations.
Functions
Section titled “Functions”| Function | Description |
|---|---|
ceil / floor | native JS Math.ceil() / Math.floor() (ES1) |
clamp | Clamps a number between min and max values |
formatSize | Format a byte count into a human-readable string with the appropriate unit. |
min / max | native JS Math.min(...arr) / Math.max(...arr) (ES1) |
randomBetween | Generates a random number between min and max (inclusive) |
randomIntBetween | Generates a random integer between min and max (inclusive) |
roundTo | Rounds a number to specified decimal places |
sum | Calculates the sum of an array of numbers. |
toInt / toFloat | native JS parseInt(str, 10) / parseFloat(str) (ES1) |